Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
NoneOf.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 "Algo/Common.h"
7#include "Templates/Invoke.h"
8
9
10namespace Algo
11{
12 /**
13 * Checks if no element in the range is truthy.
14 *
15 * @param Range The range to check.
16 *
17 * @return true if no element is truthy, false otherwise.
18 */
19 template <typename RangeType>
20 FORCEINLINE bool NoneOf(const RangeType& Range)
21 {
22 for (const auto& Element : Range)
23 {
24 if (Element)
25 {
26 return false;
27 }
28 }
29
30 return true;
31 }
32
33 /**
34 * Checks if no projection of the elements in the range is truthy.
35 *
36 * @param Range The range to check.
37 * @param Projection The projection to apply to each element.
38 *
39 * @return true if none of the projections are truthy, false otherwise.
40 */
41 template <typename RangeType, typename ProjectionType>
42 FORCEINLINE bool NoneOf(const RangeType& Range, ProjectionType Projection)
43 {
44 for (const auto& Element : Range)
45 {
47 {
48 return false;
49 }
50 }
51
52 return true;
53 }
54
55 /**
56 * Checks if no projection of the elements in the range is truthy.
57 * Should be used when the range iterator doesn't return a reference.
58 *
59 * @param Range The range to check.
60 * @param Projection The projection to apply to each element.
61 *
62 * @return true if none of the projections are truthy, false otherwise.
63 */
64 template <typename RangeType, typename ProjectionType>
65 FORCEINLINE bool NoneOf(const RangeType& Range, ProjectionType Projection, ENoRef NoRef)
66 {
67 for (const auto Element : Range)
68 {
70 {
71 return false;
72 }
73 }
74
75 return true;
76 }
77}
#define FORCEINLINE
Definition Platform.h:644
Definition Heapify.h:12
FORCEINLINE bool NoneOf(const RangeType &Range, ProjectionType Projection)
Definition NoneOf.h:42
FORCEINLINE bool NoneOf(const RangeType &Range)
Definition NoneOf.h:20
FORCEINLINE bool NoneOf(const RangeType &Range, ProjectionType Projection, ENoRef NoRef)
Definition NoneOf.h:65
ENoRef
Definition Common.h:10