|
|
FORCEINLINE ElementType * | begin () const |
| | DO NOT USE DIRECTLY STL-like iterators to enable range-based for loop support.
|
| |
|
FORCEINLINE void | CheckInvariants () const |
| | Checks array invariants: if array size is greater than zero and less than maximum.
|
| |
| template<typename ComparisonType > |
| bool | Contains (const ComparisonType &Item) const |
| | Checks if this array contains the element. 更多...
|
| |
| template<typename Predicate > |
| FORCEINLINE bool | ContainsByPredicate (Predicate Pred) const |
| | Checks if this array contains element for which the predicate is true. 更多...
|
| |
| template<typename Predicate > |
| TArray< typename TRemoveConst< ElementType >::Type > | FilterByPredicate (Predicate Pred) const |
| | Filters the elements in the array based on a predicate functor. 更多...
|
| |
| SizeType | Find (const ElementType &Item) const |
| | Finds element within the array. 更多...
|
| |
| FORCEINLINE bool | Find (const ElementType &Item, SizeType &Index) const |
| | Finds element within the array. 更多...
|
| |
| template<typename KeyType > |
| ElementType * | FindByKey (const KeyType &Key) const |
| | Finds an item by key (assuming the ElementType overloads operator== for the comparison). 更多...
|
| |
| template<typename Predicate > |
| ElementType * | FindByPredicate (Predicate Pred) const |
| | Finds an element which matches a predicate functor. 更多...
|
| |
| FORCEINLINE bool | FindLast (const ElementType &Item, SizeType &Index) const |
| | Finds element within the array starting from the end. 更多...
|
| |
| template<typename Predicate > |
| FORCEINLINE SizeType | FindLastByPredicate (Predicate Pred) const |
| | Finds element within the array starting from the end. 更多...
|
| |
| template<typename Predicate > |
| SizeType | FindLastByPredicate (Predicate Pred, SizeType StartIndex) const |
| | Finds element within the array starting from StartIndex and going backwards. 更多...
|
| |
| FORCEINLINE ElementType * | GetData () const |
| | Helper function for returning a typed pointer to the first array entry. 更多...
|
| |
| FORCEINLINE size_t | GetTypeSize () const |
| | Helper function returning the size of the inner type. 更多...
|
| |
| template<typename KeyType > |
| SizeType | IndexOfByKey (const KeyType &Key) const |
| | Finds an item by key (assuming the ElementType overloads operator== for the comparison). 更多...
|
| |
| template<typename Predicate > |
| SizeType | IndexOfByPredicate (Predicate Pred) const |
| | Finds an item by predicate. 更多...
|
| |
| FORCEINLINE bool | IsValidIndex (SizeType Index) const |
| | Tests if index is valid, i.e. 更多...
|
| |
| FORCEINLINE ElementType & | Last (SizeType IndexFromTheEnd=0) const |
| | Returns n-th last element from the array. 更多...
|
| |
| FORCEINLINE SizeType | Num () const |
| | Returns number of elements in array. 更多...
|
| |
| FORCEINLINE ElementType & | operator[] (SizeType Index) const |
| | Array bracket operator. 更多...
|
| |
| FORCEINLINE void | RangeCheck (SizeType Index) const |
| | Checks if index is in array range. 更多...
|
| |
| FORCEINLINE TArrayView | Slice (SizeType Index, SizeType InNum) const |
| | Returns a sliced view 更多...
|
| |
|
void | Sort () |
| | Sorts the array assuming < operator is defined for the item type.
|
| |
| template<class PREDICATE_CLASS > |
| void | Sort (const PREDICATE_CLASS &Predicate) |
| | Sorts the array using user define predicate class. 更多...
|
| |
| void | StableSort () |
| | Stable sorts the array assuming < operator is defined for the item type. 更多...
|
| |
| template<class PREDICATE_CLASS > |
| void | StableSort (const PREDICATE_CLASS &Predicate) |
| | Stable sorts the array using user defined predicate class. 更多...
|
| |
|
| TArrayView () |
| | Constructor.
|
| |
| template<typename OtherElementType , typename = typename TEnableIf<TIsCompatibleElementType<OtherElementType>::Value>::Type> |
| FORCEINLINE | TArrayView (OtherElementType *InData, SizeType InCount) |
| | Construct a view of an arbitrary pointer 更多...
|
| |
| template<typename OtherRangeType , typename CVUnqualifiedOtherRangeType = typename TRemoveCV<typename TRemoveReference<OtherRangeType>::Type>::Type, typename = typename TEnableIf< TAnd< TIsContiguousContainer<CVUnqualifiedOtherRangeType>, TIsCompatibleRangeType<OtherRangeType> >::Value >::Type> |
| FORCEINLINE | TArrayView (OtherRangeType &&Other) |
| | Constructor from another range 更多...
|
| |
| FORCEINLINE | TArrayView (std::initializer_list< ElementType > List) |
| | Construct a view of an initializer list. 更多...
|
| |
template<typename InElementType, typename InSizeType>
class TArrayView< InElementType, InSizeType >
Templated fixed-size view of another array
A statically sized view of an array of typed elements. Designed to allow functions to take either a fixed C array or a TArray with an arbitrary allocator as an argument when the function neither adds nor removes elements
e.g.: int32 SumAll(TArrayView<const int32> array) { return Algo::Accumulate(array); }
could be called as: SumAll(MyTArray);\ SumAll(MyCArray); SumAll(MakeArrayView(Ptr, Num));
auto Values = { 1, 2, 3 }; SumAll(Values);
Note: View classes are not const-propagating! If you want a view where the elements are const, you need "TArrayView<const T>" not "const TArrayView<T>"!
Caution: Treat a view like a reference to the elements in the array. DO NOT free or reallocate the array while the view exists! For this reason, be mindful of lifetime when constructing TArrayViews from rvalue initializer lists:
TArrayView<int> View = { 1, 2, 3 }; // construction of array view from rvalue initializer list int n = View[0]; // undefined behavior, as the initializer list was destroyed at the end of the previous line