Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
ForEach.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
8namespace Algo
9{
10 /**
11 * Conditionally invokes a callable to each element in a range
12 *
13 * @param Input Any iterable type
14 * @param Predicate Condition which returns true for elements that should be called with and false for elements that should be skipped
15 * @param Callable Callable object
16 */
17 template <typename InT, typename PredicateT, typename CallableT>
18 FORCEINLINE void ForEachIf(InT& Input, PredicateT Predicate, CallableT Callable)
19 {
20 for (auto& Value : Input)
21 {
23 {
25 }
26 }
27 }
28
29 /**
30 * Invokes a callable to each element in a range
31 *
32 * @param Input Any iterable type
33 * @param Callable Callable object
34 */
35 template <typename InT, typename CallableT>
36 FORCEINLINE void ForEach(InT& Input, CallableT Callable)
37 {
38 for (auto& Value : Input)
39 {
41 }
42 }
43}
#define FORCEINLINE
Definition Platform.h:644
Definition Heapify.h:12
FORCEINLINE void ForEachIf(InT &Input, PredicateT Predicate, CallableT Callable)
Definition ForEach.h:18
FORCEINLINE void ForEach(InT &Input, CallableT Callable)
Definition ForEach.h:36