Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
Copy.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
8namespace Algo
9{
10 /**
11 * Conditionally copies a range into a container
12 *
13 * @param Input Any iterable type
14 * @param Output Container to hold the output
15 * @param Predicate Condition which returns true for elements that should be copied and false for elements that should be skipped
16 */
17 template <typename InT, typename OutT, typename PredicateT>
18 FORCEINLINE void CopyIf(const InT& Input, OutT& Output, PredicateT Predicate)
19 {
20 for (const auto& Value : Input)
21 {
23 {
25 }
26 }
27 }
28
29 /**
30 * Copies a range into a container
31 *
32 * @param Input Any iterable type
33 * @param Output Container to hold the output
34 */
35 template <typename InT, typename OutT>
36 FORCEINLINE void Copy(const InT& Input, OutT& Output)
37 {
38 for (const auto& Value : Input)
39 {
41 }
42 }
43
44 /**
45 * Copies a range into a container.
46 * Should be used if when the input iterator doesn't return a reference.
47 *
48 * @param Input Any iterable type
49 * @param Output Container to hold the output
50 */
51 template <typename InT, typename OutT>
52 FORCEINLINE void Copy(const InT& Input, OutT& Output, ENoRef NoRef)
53 {
54 for (const auto Value : Input)
55 {
57 }
58 }
59}
#define FORCEINLINE
Definition Platform.h:644
Definition Heapify.h:12
FORCEINLINE void CopyIf(const InT &Input, OutT &Output, PredicateT Predicate)
Definition Copy.h:18
FORCEINLINE void Copy(const InT &Input, OutT &Output)
Definition Copy.h:36
FORCEINLINE void Copy(const InT &Input, OutT &Output, ENoRef NoRef)
Definition Copy.h:52
ENoRef
Definition Common.h:10