11#include "Templates/Invoke.h"
14#include "Containers/Array.h"
26 template <
typename T,
typename ElementType>
42 using NaturalElementType = std::remove_pointer_t<
decltype(
NaturalPtr)>;
54 template <
typename RangeType,
typename ElementType>
60 static constexpr decltype(
auto)
GetData(T&& Arg)
69 template <
typename RangeType,
typename ElementType>
73 using NaturalElementType = std::remove_pointer_t<decltype(GetData(DeclVal<RangeType&>()))>;
78 !std::is_same_v<typename TypeCompat::ReinterpretType, NaturalElementType>
83 || std::is_same_v<ElementType, std::remove_pointer_t<typename TypeCompat::ReinterpretType>*
const>
84 || std::is_same_v<ElementType, const std::remove_pointer_t<typename TypeCompat::ReinterpretType>*
const>);
137template<
typename InElementType,
typename InSizeType>
144 static_assert(std::is_signed_v<SizeType>,
"TArrayView only supports signed index types");
161 template <
typename T>
164 template <
typename T>
185 !std::is_same_v<CVUnqualifiedOtherRangeType, TArrayView>
189 : DataPtr(std::conditional_t<
221 : DataPtr(std::conditional_t<
248 UE_REQUIRES(UE::Core::ArrayView::Private::TIsCompatibleElementType_V<OtherElementType, ElementType>)
254 check(ArrayNum >= 0);
266 static_assert(std::is_const_v<ElementType>,
"Only views of const elements can bind to initializer lists");
282 return ArrayNum == -1;
335 checkf((
Index >= 0) & (
Index < ArrayNum),
TEXT(
"Array index out of bounds: %lld from an array of size %lld"), (
long long)
Index, (
long long)ArrayNum);
349 checkf(
Index +
InNum <= ArrayNum,
TEXT(
"Range (index: %lld, count: %lld) lies outside the view of %lld elements"), (
long long)
Index, (
long long)
InNum, (
long long)ArrayNum);
372 return ArrayNum == 0;
537 return static_cast<SizeType>(Data - Start);
570 return static_cast<SizeType>(Data - Start);
584 template <
typename Predicate>
593 return static_cast<SizeType>(Data - Start);
606 template <
typename Predicate>
621 template <
typename KeyType>
629 return static_cast<SizeType>(Data - Start);
643 template <
typename Predicate>
651 return static_cast<SizeType>(Data - Start);
665 template <
typename KeyType>
687 template <
typename Predicate>
709 template <
typename Predicate>
728 template <
typename ComparisonType>
748 template <
typename Predicate>
787 template <
class PREDICATE_CLASS>
819 template <
class PREDICATE_CLASS>
829 template <
typename OtherElementType,
typename OtherSizeType>
838 template <
typename RangeType>
839 requires (std::is_convertible_v<decltype(UE::Core::ArrayView::Private::GetDataHelper(std::declval<RangeType&>())),
const ElementType*>)
854template <
typename InElementType>
860template <
typename T,
typename SizeType>
887template<
typename ElementType>
893template <
typename ElementType>
918template<
typename ElementType>
924template <
typename ElementType>
932template<
typename InElementType,
typename InAllocatorType>
933template<
typename OtherElementType,
typename OtherSizeType>
939template<
typename InElementType,
typename InAllocatorType>
940template<
typename OtherElementType,
typename OtherSizeType>
944 CopyToEmpty(
Other.GetData(),
Other.Num(), ArrayMax);
constexpr auto MakeArrayView(OtherRangeType &&Other)
Definition ArrayView.h:873
constexpr bool TIsTArrayView_V
Definition ArrayView.h:94
constexpr auto MakeConstArrayView(OtherRangeType &&Other)
Definition ArrayView.h:904
#define checkSlow(expr)
Definition AssertionMacros.h:332
#define check(expr)
Definition AssertionMacros.h:314
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
#define UE_DEPRECATE_MUTABLE_TOBJECTPTR
Definition CoreDefines.h:55
@ INDEX_NONE
Definition CoreMiscDefines.h:150
AUTORTFM_INFER UE_FORCEINLINE_HINT constexpr auto Invoke(FuncType &&Func, ArgTypes &&... Args) -> decltype(((FuncType &&) Func)((ArgTypes &&) Args...))
Definition Invoke.h:44
FORCEINLINE constexpr void DestructItems(ElementType *Element, SizeType Count)
Definition MemoryOps.h:81
FORCEINLINE bool CompareItems(const ElementType *A, const ElementType *B, SizeType Count)
Definition MemoryOps.h:287
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define UE_REQUIRES(...)
Definition Requires.h:86
auto GetNum(const TStringConversion< Converter, DefaultConversionSize > &Conversion) -> decltype(Conversion.Length())
Definition StringConv.h:808
auto GetData(const TStringConversion< Converter, DefaultConversionSize > &Conversion) -> decltype(Conversion.Get())
Definition StringConv.h:802
uint32 Size
Definition VulkanMemory.cpp:4034
Definition Core.Build.cs:8
Definition ArrayView.h:139
constexpr TArrayView(const TArrayView &)=default
constexpr void Sort()
Definition ArrayView.h:773
constexpr SizeType IndexOfByPredicate(Predicate Pred) const
Definition ArrayView.h:644
constexpr void RightChopInline(SizeType CharCount)
Definition ArrayView.h:498
constexpr SizeType Find(const ElementType &Item) const
Definition ArrayView.h:530
constexpr TArrayView(std::initializer_list< ElementType > List UE_LIFETIMEBOUND)
Definition ArrayView.h:262
constexpr TArrayView Mid(SizeType Index, SizeType Count=TNumericLimits< SizeType >::Max()) const
Definition ArrayView.h:459
UE_FORCEINLINE_HINT constexpr ElementType * end() const
Definition ArrayView.h:760
constexpr ElementType * FindByKey(const KeyType &Key) const
Definition ArrayView.h:666
constexpr void RightInline(SizeType CharCount)
Definition ArrayView.h:492
UE_FORCEINLINE_HINT constexpr ElementType * GetData() const
Definition ArrayView.h:295
constexpr SizeType FindLast(const ElementType &Item) const
Definition ArrayView.h:563
constexpr SizeType IndexOfByKey(const KeyType &Key) const
Definition ArrayView.h:622
constexpr TArrayView RightChop(SizeType Count) const
Definition ArrayView.h:452
UE_FORCEINLINE_HINT constexpr bool ContainsByPredicate(Predicate Pred) const
Definition ArrayView.h:749
TArrayView & operator=(const TArrayView &)=default
InSizeType SizeType
Definition ArrayView.h:142
constexpr void StableSort()
Definition ArrayView.h:803
constexpr bool Contains(const ComparisonType &Item) const
Definition ArrayView.h:729
constexpr bool FindLast(const ElementType &Item, SizeType &Index) const
Definition ArrayView.h:551
constexpr void StableSort(const PREDICATE_CLASS &Predicate)
Definition ArrayView.h:820
constexpr TArrayView()
Definition ArrayView.h:154
constexpr void Sort(const PREDICATE_CLASS &Predicate)
Definition ArrayView.h:788
constexpr void MidInline(SizeType Position, SizeType CharCount=TNumericLimits< SizeType >::Max())
Definition ArrayView.h:504
constexpr TArrayView(OtherRangeType &&Other UE_LIFETIMEBOUND)
Definition ArrayView.h:220
constexpr void LeftInline(SizeType CharCount)
Definition ArrayView.h:480
constexpr TArrayView Right(SizeType Count) const
Definition ArrayView.h:445
UE_FORCEINLINE_HINT constexpr SizeType Num() const
Definition ArrayView.h:380
constexpr ElementType * FindByPredicate(Predicate Pred) const
Definition ArrayView.h:688
constexpr TArrayView LeftChop(SizeType Count) const
Definition ArrayView.h:439
constexpr TArrayView(OtherRangeType &&Other)
Definition ArrayView.h:188
bool UEOpEquals(RangeType &&Rhs) const
Definition ArrayView.h:840
constexpr TArrayView Left(SizeType Count) const
Definition ArrayView.h:433
constexpr TArray< std::remove_const_t< ElementType > > FilterByPredicate(Predicate Pred) const
Definition ArrayView.h:710
constexpr TArrayView(FIntrusiveUnsetOptionalState)
Definition ArrayView.h:275
constexpr bool IsEmpty() const
Definition ArrayView.h:370
UE_FORCEINLINE_HINT constexpr void CheckInvariants() const
Definition ArrayView.h:321
constexpr void LeftChopInline(SizeType CharCount)
Definition ArrayView.h:486
UE_FORCEINLINE_HINT constexpr bool IsValidIndex(SizeType Index) const
Definition ArrayView.h:359
constexpr SizeType FindLastByPredicate(Predicate Pred, SizeType StartIndex) const
Definition ArrayView.h:585
constexpr bool UEOpEquals(FIntrusiveUnsetOptionalState) const
Definition ArrayView.h:280
constexpr ElementType & Last(SizeType IndexFromTheEnd=0) const
Definition ArrayView.h:410
constexpr void SliceRangeCheck(SizeType Index, SizeType InNum) const
Definition ArrayView.h:345
static UE_FORCEINLINE_HINT constexpr size_t GetTypeAlignment()
Definition ArrayView.h:313
UE_FORCEINLINE_HINT constexpr TReversePointerIterator< ElementType > rend() const
Definition ArrayView.h:762
bool UEOpEquals(TArrayView< OtherElementType, OtherSizeType >) const =delete
static UE_FORCEINLINE_HINT constexpr size_t GetTypeSize()
Definition ArrayView.h:305
UE_FORCEINLINE_HINT constexpr ElementType * begin() const
Definition ArrayView.h:759
UE_FORCEINLINE_HINT constexpr TReversePointerIterator< ElementType > rbegin() const
Definition ArrayView.h:761
UE_FORCEINLINE_HINT constexpr SizeType FindLastByPredicate(Predicate Pred) const
Definition ArrayView.h:607
constexpr void RangeCheck(SizeType Index) const
Definition ArrayView.h:331
constexpr TArrayView(OtherElementType *InData UE_LIFETIMEBOUND, SizeType InCount)
Definition ArrayView.h:250
static constexpr bool bHasIntrusiveUnsetOptionalState
Definition ArrayView.h:272
constexpr TArrayView Slice(SizeType Index, SizeType InNum) const
Definition ArrayView.h:426
UE_FORCEINLINE_HINT constexpr SIZE_T NumBytes() const
Definition ArrayView.h:386
InElementType ElementType
Definition ArrayView.h:141
constexpr ElementType & operator[](SizeType Index) const
Definition ArrayView.h:396
constexpr bool Find(const ElementType &Item, SizeType &Index) const
Definition ArrayView.h:517
UE_NODEBUG UE_FORCEINLINE_HINT SizeType Add(ElementType &&Item)
Definition Array.h:2696
friend class TArray
Array that allocates elements on the heap.
Definition Array.h:672
TArray & operator=(std::initializer_list< InElementType > InitList)
Definition Array.h:785
UE_REWRITE void Sort(RangeType &&Range)
Definition Sort.h:16
UE_REWRITE void StableSort(RangeType &&Range)
Definition StableSort.h:125
Definition OverriddenPropertySet.cpp:45
Definition ArrayView.h:19
UE_FORCEINLINE_HINT constexpr auto GetDataHelper(T &&Arg) -> decltype(GetData(Forward< T >(Arg)))
Definition ArrayView.h:32
constexpr bool TIsCompatibleElementType_V
Definition ArrayView.h:27
decltype(auto) GetReinterpretedDataHelper(T &&Arg)
Definition ArrayView.h:39
Definition AdvancedWidgetsModule.cpp:13
U16 Index
Definition radfft.cpp:71
Definition IntrusiveUnsetOptionalState.h:71
static constexpr UE_FORCEINLINE_HINT T Clamp(const T X, const T MinValue, const T MaxValue)
Definition UnrealMathUtility.h:592
Definition ContainerElementTypeCompatibility.h:15
InElementType ReinterpretType
Definition ContainerElementTypeCompatibility.h:16
static void ReinterpretRangeContiguous(IterBeginType Iter, IterEndType IterEnd, SizeType Size, OperatorType Operator=[](IterBeginType &InIt) -> InElementType &{ return *InIt;})
Definition ContainerElementTypeCompatibility.h:25
Definition IsContiguousContainer.h:16
static constexpr bool Value
Definition IsContiguousContainer.h:20
Definition ArrayView.h:102
static constexpr bool Value
Definition ArrayView.h:103
static constexpr bool value
Definition ArrayView.h:104
Definition UnrealTypeTraits.h:172
Definition NumericLimits.h:41
Definition ReverseIterate.h:13
Definition ArrayView.h:56
static constexpr decltype(auto) GetData(T &&Arg)
Definition ArrayView.h:60
static constexpr bool Value
Definition ArrayView.h:57
Definition ArrayView.h:71
static constexpr bool Value
Definition ArrayView.h:77
static decltype(auto) GetData(T &&Arg)
Definition ArrayView.h:87