UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ArrayBuilder.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"
7#include "Containers/Array.h"
8
15template<typename ElementType, typename Allocator = FDefaultAllocator> class TArrayBuilder
16{
17public:
18
21
27 template<typename OtherAllocator> TArrayBuilder( const TArray<ElementType, OtherAllocator>& InArray )
28 : Array(InArray)
29 { }
30
31public:
32
40 TArrayBuilder& Add( const ElementType& Item )
41 {
42 Array.Add(Item);
43
44 return *this;
45 }
46
54 TArrayBuilder& AddUnique( const ElementType& Item )
55 {
56 Array.AddUnique(Item);
57
58 return *this;
59 }
60
67 template<typename OtherAllocator> TArrayBuilder& Append( const TArray<ElementType, OtherAllocator>& OtherArray )
68 {
69 Array.Append(OtherArray);
70
71 return *this;
72 }
73
74public:
75
82 {
83 return Array;
84 }
85
92 {
93 return Build();
94 }
95
96private:
97
100};
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition ArrayBuilder.h:16
TArrayBuilder & Append(const TArray< ElementType, OtherAllocator > &OtherArray)
Definition ArrayBuilder.h:67
TArray< ElementType, Allocator > Build()
Definition ArrayBuilder.h:81
TArrayBuilder & AddUnique(const ElementType &Item)
Definition ArrayBuilder.h:54
TArrayBuilder & Add(const ElementType &Item)
Definition ArrayBuilder.h:40
TArrayBuilder()
Definition ArrayBuilder.h:20
TArrayBuilder(const TArray< ElementType, OtherAllocator > &InArray)
Definition ArrayBuilder.h:27
Definition Array.h:670
UE_NODEBUG UE_FORCEINLINE_HINT SizeType Add(ElementType &&Item)
Definition Array.h:2696
void Append(const TArray< OtherElementType, OtherAllocatorType > &Source)
Definition Array.h:2412
UE_FORCEINLINE_HINT SizeType AddUnique(ElementType &&Item)
Definition Array.h:2993