Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
AllOf.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
6#include "Templates/Invoke.h"
7
8
9namespace Algo
10{
11 /**
12 * Checks if every element in the range is truthy.
13 *
14 * @param Range The range to check.
15 *
16 * @return true if all the elements are truthy, false otherwise.
17 */
18 template <typename RangeType>
19 FORCEINLINE bool AllOf(const RangeType& Range)
20 {
21 for (const auto& Element : Range)
22 {
23 if (!Element)
24 {
25 return false;
26 }
27 }
28
29 return true;
30 }
31
32 /**
33 * Checks if every projection of the elements in the range is truthy.
34 *
35 * @param Range The range to check.
36 * @param Projection The projection to apply to each element.
37 *
38 * @return true if all the projections are truthy, false otherwise.
39 */
40 template <typename RangeType, typename ProjectionType>
41 FORCEINLINE bool AllOf(const RangeType& Range, ProjectionType Projection)
42 {
43 for (const auto& Element : Range)
44 {
46 {
47 return false;
48 }
49 }
50
51 return true;
52 }
53}
#define FORCEINLINE
Definition Platform.h:644
Definition Heapify.h:12
FORCEINLINE bool AllOf(const RangeType &Range, ProjectionType Projection)
Definition AllOf.h:41
FORCEINLINE bool AllOf(const RangeType &Range)
Definition AllOf.h:19