fix(containers): remove qualifiers for Iterator::ElementType
This commit is contained in:
parent
1f20b782bf
commit
1cfa252779
@ -259,10 +259,10 @@ void TestStringView()
|
||||
always_check(ViewI == LITERAL(T, "Hello, World! Goodbye, World!"));
|
||||
always_check(ViewII == LITERAL(T, "Hello, World! Goodbye, World!"));
|
||||
|
||||
TStringView<T> ViewA(ViewI.Begin(), 13);
|
||||
TStringView<T> ViewB(ViewI.Begin(), ViewI.End());
|
||||
TStringView<T> ViewC(&Buffer[0], 13);
|
||||
TStringView<T> ViewD(&Buffer[0]);
|
||||
TStringView ViewA(ViewI.Begin(), 13);
|
||||
TStringView ViewB(ViewI.Begin(), ViewI.End());
|
||||
TStringView ViewC(&Buffer[0], 13);
|
||||
TStringView ViewD(&Buffer[0]);
|
||||
|
||||
always_check(ViewA == LITERAL(T, "Hello, World!"));
|
||||
always_check(ViewB == LITERAL(T, "Hello, World! Goodbye, World!"));
|
||||
@ -335,10 +335,11 @@ void TestTemplateString()
|
||||
always_check(TStringView(Empty.ToCString()) == LITERAL(T, ""));
|
||||
|
||||
TString<T> StrA(32, LITERAL(T, 'A'));
|
||||
TString<T> StrB(LITERAL(T, "ABCDEFG"), 3);
|
||||
TString<T> StrC(LITERAL(T, "ABCDEFG"));
|
||||
TString<T> StrD(TStringView(LITERAL(T, "ABCDEFG")));
|
||||
TString<T> StrE({ LITERAL(T, 'A'), LITERAL(T, 'B'), LITERAL(T, 'C') });
|
||||
|
||||
TString StrB(LITERAL(T, "ABCDEFG"), 3);
|
||||
TString StrC(LITERAL(T, "ABCDEFG"));
|
||||
TString StrD(TStringView(LITERAL(T, "ABCDEFG")));
|
||||
TString StrE({ LITERAL(T, 'A'), LITERAL(T, 'B'), LITERAL(T, 'C') });
|
||||
|
||||
always_check(TStringView(StrA.ToCString()) == LITERAL(T, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"));
|
||||
always_check(TStringView(StrB.ToCString()) == LITERAL(T, "ABC"));
|
||||
@ -346,11 +347,11 @@ void TestTemplateString()
|
||||
always_check(TStringView(StrD.ToCString()) == LITERAL(T, "ABCDEFG"));
|
||||
always_check(TStringView(StrE.ToCString()) == LITERAL(T, "ABC"));
|
||||
|
||||
TString<T> StrI(StrC);
|
||||
TString<T> StrII(MoveTemp(StrC));
|
||||
TString StrI(StrC);
|
||||
TString StrII(MoveTemp(StrC));
|
||||
|
||||
TString<T> StrIII = Empty;
|
||||
TString<T> StrIV = Empty;
|
||||
TString StrIII = Empty;
|
||||
TString StrIV = Empty;
|
||||
|
||||
StrIII = StrD;
|
||||
StrIV = MoveTemp(StrD);
|
||||
@ -370,7 +371,7 @@ void TestTemplateString()
|
||||
}
|
||||
|
||||
{
|
||||
TString<T> Str = LITERAL(T, "A");
|
||||
TString Str = LITERAL(T, "A");
|
||||
|
||||
always_check(!Str.IsEmpty());
|
||||
always_check(Str.Num() == 1);
|
||||
@ -398,7 +399,7 @@ void TestTemplateString()
|
||||
}
|
||||
|
||||
{
|
||||
TString<T> Str = LITERAL(T, "##");
|
||||
TString Str = LITERAL(T, "##");
|
||||
|
||||
Str.Insert(1, LITERAL(T, 'A'));
|
||||
|
||||
@ -418,7 +419,7 @@ void TestTemplateString()
|
||||
}
|
||||
|
||||
{
|
||||
TString<T> Str = LITERAL(T, "A");
|
||||
TString Str = LITERAL(T, "A");
|
||||
|
||||
Str.PushBack(LITERAL(T, 'B'));
|
||||
|
||||
|
@ -23,8 +23,8 @@ class TArray final
|
||||
{
|
||||
private:
|
||||
|
||||
template <bool bConst>
|
||||
class IteratorImpl;
|
||||
template <bool bConst, typename = TConditional<bConst, const T, T>>
|
||||
class TIteratorImpl;
|
||||
|
||||
public:
|
||||
|
||||
@ -34,8 +34,8 @@ public:
|
||||
using Reference = T&;
|
||||
using ConstReference = const T&;
|
||||
|
||||
using Iterator = IteratorImpl<false>;
|
||||
using ConstIterator = IteratorImpl<true >;
|
||||
using Iterator = TIteratorImpl<false>;
|
||||
using ConstIterator = TIteratorImpl<true >;
|
||||
|
||||
using ReverseIterator = TReverseIterator< Iterator>;
|
||||
using ConstReverseIterator = TReverseIterator<ConstIterator>;
|
||||
@ -975,56 +975,56 @@ private:
|
||||
|
||||
private:
|
||||
|
||||
template <bool bConst>
|
||||
class IteratorImpl
|
||||
template <bool bConst, typename U>
|
||||
class TIteratorImpl
|
||||
{
|
||||
public:
|
||||
|
||||
using ElementType = TConditional<bConst, const T, T>;
|
||||
using ElementType = TRemoveCV<T>;
|
||||
|
||||
FORCEINLINE IteratorImpl() = default;
|
||||
FORCEINLINE TIteratorImpl() = default;
|
||||
|
||||
# if DO_CHECK
|
||||
FORCEINLINE IteratorImpl(const IteratorImpl<false>& InValue) requires (bConst)
|
||||
FORCEINLINE TIteratorImpl(const TIteratorImpl<false>& InValue) requires (bConst)
|
||||
: Owner(InValue.Owner), Pointer(InValue.Pointer)
|
||||
{ }
|
||||
# else
|
||||
FORCEINLINE IteratorImpl(const IteratorImpl<false>& InValue) requires (bConst)
|
||||
FORCEINLINE TIteratorImpl(const TIteratorImpl<false>& InValue) requires (bConst)
|
||||
: Pointer(InValue.Pointer)
|
||||
{ }
|
||||
# endif
|
||||
|
||||
FORCEINLINE IteratorImpl(const IteratorImpl&) = default;
|
||||
FORCEINLINE IteratorImpl(IteratorImpl&&) = default;
|
||||
FORCEINLINE IteratorImpl& operator=(const IteratorImpl&) = default;
|
||||
FORCEINLINE IteratorImpl& operator=(IteratorImpl&&) = default;
|
||||
FORCEINLINE TIteratorImpl(const TIteratorImpl&) = default;
|
||||
FORCEINLINE TIteratorImpl(TIteratorImpl&&) = default;
|
||||
FORCEINLINE TIteratorImpl& operator=(const TIteratorImpl&) = default;
|
||||
FORCEINLINE TIteratorImpl& operator=(TIteratorImpl&&) = default;
|
||||
|
||||
NODISCARD friend FORCEINLINE bool operator==(const IteratorImpl& LHS, const IteratorImpl& RHS) { return LHS.Pointer == RHS.Pointer; }
|
||||
NODISCARD friend FORCEINLINE bool operator==(const TIteratorImpl& LHS, const TIteratorImpl& RHS) { return LHS.Pointer == RHS.Pointer; }
|
||||
|
||||
NODISCARD friend FORCEINLINE strong_ordering operator<=>(const IteratorImpl& LHS, const IteratorImpl& RHS) { return LHS.Pointer <=> RHS.Pointer; }
|
||||
NODISCARD friend FORCEINLINE strong_ordering operator<=>(const TIteratorImpl& LHS, const TIteratorImpl& RHS) { return LHS.Pointer <=> RHS.Pointer; }
|
||||
|
||||
NODISCARD FORCEINLINE ElementType& operator*() const { CheckThis(true); return *Pointer; }
|
||||
NODISCARD FORCEINLINE ElementType* operator->() const { CheckThis(true); return Pointer; }
|
||||
NODISCARD FORCEINLINE U& operator*() const { CheckThis(true); return *Pointer; }
|
||||
NODISCARD FORCEINLINE U* operator->() const { CheckThis(true); return Pointer; }
|
||||
|
||||
NODISCARD FORCEINLINE ElementType& operator[](ptrdiff Index) const { IteratorImpl Temp = *this + Index; return *Temp; }
|
||||
NODISCARD FORCEINLINE U& operator[](ptrdiff Index) const { TIteratorImpl Temp = *this + Index; return *Temp; }
|
||||
|
||||
FORCEINLINE IteratorImpl& operator++() { ++Pointer; CheckThis(); return *this; }
|
||||
FORCEINLINE IteratorImpl& operator--() { --Pointer; CheckThis(); return *this; }
|
||||
FORCEINLINE TIteratorImpl& operator++() { ++Pointer; CheckThis(); return *this; }
|
||||
FORCEINLINE TIteratorImpl& operator--() { --Pointer; CheckThis(); return *this; }
|
||||
|
||||
FORCEINLINE IteratorImpl operator++(int) { IteratorImpl Temp = *this; ++*this; return Temp; }
|
||||
FORCEINLINE IteratorImpl operator--(int) { IteratorImpl Temp = *this; --*this; return Temp; }
|
||||
FORCEINLINE TIteratorImpl operator++(int) { TIteratorImpl Temp = *this; ++*this; return Temp; }
|
||||
FORCEINLINE TIteratorImpl operator--(int) { TIteratorImpl Temp = *this; --*this; return Temp; }
|
||||
|
||||
FORCEINLINE IteratorImpl& operator+=(ptrdiff Offset) { Pointer += Offset; CheckThis(); return *this; }
|
||||
FORCEINLINE IteratorImpl& operator-=(ptrdiff Offset) { Pointer -= Offset; CheckThis(); return *this; }
|
||||
FORCEINLINE TIteratorImpl& operator+=(ptrdiff Offset) { Pointer += Offset; CheckThis(); return *this; }
|
||||
FORCEINLINE TIteratorImpl& operator-=(ptrdiff Offset) { Pointer -= Offset; CheckThis(); return *this; }
|
||||
|
||||
NODISCARD friend FORCEINLINE IteratorImpl operator+(IteratorImpl Iter, ptrdiff Offset) { IteratorImpl Temp = Iter; Temp += Offset; return Temp; }
|
||||
NODISCARD friend FORCEINLINE IteratorImpl operator+(ptrdiff Offset, IteratorImpl Iter) { IteratorImpl Temp = Iter; Temp += Offset; return Temp; }
|
||||
NODISCARD friend FORCEINLINE TIteratorImpl operator+(TIteratorImpl Iter, ptrdiff Offset) { TIteratorImpl Temp = Iter; Temp += Offset; return Temp; }
|
||||
NODISCARD friend FORCEINLINE TIteratorImpl operator+(ptrdiff Offset, TIteratorImpl Iter) { TIteratorImpl Temp = Iter; Temp += Offset; return Temp; }
|
||||
|
||||
NODISCARD FORCEINLINE IteratorImpl operator-(ptrdiff Offset) const { IteratorImpl Temp = *this; Temp -= Offset; return Temp; }
|
||||
NODISCARD FORCEINLINE TIteratorImpl operator-(ptrdiff Offset) const { TIteratorImpl Temp = *this; Temp -= Offset; return Temp; }
|
||||
|
||||
NODISCARD friend FORCEINLINE ptrdiff operator-(const IteratorImpl& LHS, const IteratorImpl& RHS) { LHS.CheckThis(); RHS.CheckThis(); return LHS.Pointer - RHS.Pointer; }
|
||||
NODISCARD friend FORCEINLINE ptrdiff operator-(const TIteratorImpl& LHS, const TIteratorImpl& RHS) { LHS.CheckThis(); RHS.CheckThis(); return LHS.Pointer - RHS.Pointer; }
|
||||
|
||||
NODISCARD FORCEINLINE explicit operator TObserverPtr<ElementType[]>() const { CheckThis(); return TObserverPtr<ElementType[]>(Pointer); }
|
||||
NODISCARD FORCEINLINE explicit operator TObserverPtr<U[]>() const { CheckThis(); return TObserverPtr<U[]>(Pointer); }
|
||||
|
||||
private:
|
||||
|
||||
@ -1032,14 +1032,14 @@ private:
|
||||
const TArray* Owner = nullptr;
|
||||
# endif
|
||||
|
||||
ElementType* Pointer = nullptr;
|
||||
U* Pointer = nullptr;
|
||||
|
||||
# if DO_CHECK
|
||||
FORCEINLINE IteratorImpl(const TArray* InContainer, ElementType* InPointer)
|
||||
FORCEINLINE TIteratorImpl(const TArray* InContainer, U* InPointer)
|
||||
: Owner(InContainer), Pointer(InPointer)
|
||||
{ }
|
||||
# else
|
||||
FORCEINLINE IteratorImpl(const TArray* InContainer, ElementType* InPointer)
|
||||
FORCEINLINE TIteratorImpl(const TArray* InContainer, U* InPointer)
|
||||
: Pointer(InPointer)
|
||||
{ }
|
||||
# endif
|
||||
@ -1050,7 +1050,7 @@ private:
|
||||
checkf(!(bExceptEnd && Owner->End() == *this), TEXT("Read access violation. Please check IsValidIterator()."));
|
||||
}
|
||||
|
||||
template <bool> friend class IteratorImpl;
|
||||
template <bool, typename> friend class TIteratorImpl;
|
||||
|
||||
friend TArray;
|
||||
|
||||
|
@ -303,7 +303,7 @@ public:
|
||||
{
|
||||
public:
|
||||
|
||||
using ElementType = T;
|
||||
using ElementType = TRemoveCV<T>;
|
||||
|
||||
FORCEINLINE constexpr Iterator() = default;
|
||||
FORCEINLINE constexpr Iterator(const Iterator&) = default;
|
||||
@ -315,10 +315,10 @@ public:
|
||||
|
||||
NODISCARD friend FORCEINLINE constexpr strong_ordering operator<=>(const Iterator& LHS, const Iterator& RHS) { return LHS.Pointer <=> RHS.Pointer; }
|
||||
|
||||
NODISCARD FORCEINLINE constexpr ElementType& operator*() const { CheckThis(true); return *Pointer; }
|
||||
NODISCARD FORCEINLINE constexpr ElementType* operator->() const { CheckThis(true); return Pointer; }
|
||||
NODISCARD FORCEINLINE constexpr T& operator*() const { CheckThis(true); return *Pointer; }
|
||||
NODISCARD FORCEINLINE constexpr T* operator->() const { CheckThis(true); return Pointer; }
|
||||
|
||||
NODISCARD FORCEINLINE constexpr ElementType& operator[](ptrdiff Index) const { Iterator Temp = *this + Index; return *Temp; }
|
||||
NODISCARD FORCEINLINE constexpr T& operator[](ptrdiff Index) const { Iterator Temp = *this + Index; return *Temp; }
|
||||
|
||||
FORCEINLINE constexpr Iterator& operator++() { ++Pointer; CheckThis(); return *this; }
|
||||
FORCEINLINE constexpr Iterator& operator--() { --Pointer; CheckThis(); return *this; }
|
||||
@ -336,7 +336,7 @@ public:
|
||||
|
||||
NODISCARD friend FORCEINLINE constexpr ptrdiff operator-(const Iterator& LHS, const Iterator& RHS) { LHS.CheckThis(); RHS.CheckThis(); return LHS.Pointer - RHS.Pointer; }
|
||||
|
||||
NODISCARD FORCEINLINE constexpr explicit operator TObserverPtr<ElementType[]>() const { CheckThis(); return TObserverPtr<ElementType[]>(Pointer); }
|
||||
NODISCARD FORCEINLINE constexpr explicit operator TObserverPtr<T[]>() const { CheckThis(); return TObserverPtr<T[]>(Pointer); }
|
||||
|
||||
private:
|
||||
|
||||
@ -344,14 +344,14 @@ public:
|
||||
const TArrayView* Owner = nullptr;
|
||||
# endif
|
||||
|
||||
ElementType* Pointer = nullptr;
|
||||
T* Pointer = nullptr;
|
||||
|
||||
# if DO_CHECK
|
||||
FORCEINLINE constexpr Iterator(const TArrayView* InContainer, ElementType* InPointer)
|
||||
FORCEINLINE constexpr Iterator(const TArrayView* InContainer, T* InPointer)
|
||||
: Owner(InContainer), Pointer(InPointer)
|
||||
{ }
|
||||
# else
|
||||
FORCEINLINE constexpr Iterator(const TArrayView* InContainer, ElementType* InPointer)
|
||||
FORCEINLINE constexpr Iterator(const TArrayView* InContainer, T* InPointer)
|
||||
: Pointer(InPointer)
|
||||
{ }
|
||||
# endif
|
||||
|
@ -26,7 +26,7 @@ class TBitset final
|
||||
private:
|
||||
|
||||
template <bool bConst>
|
||||
class IteratorImpl;
|
||||
class TIteratorImpl;
|
||||
|
||||
public:
|
||||
|
||||
@ -37,8 +37,8 @@ public:
|
||||
class Reference;
|
||||
using ConstReference = bool;
|
||||
|
||||
using Iterator = IteratorImpl<false>;
|
||||
using ConstIterator = IteratorImpl<true >;
|
||||
using Iterator = TIteratorImpl<false>;
|
||||
using ConstIterator = TIteratorImpl<true >;
|
||||
|
||||
using ReverseIterator = TReverseIterator< Iterator>;
|
||||
using ConstReverseIterator = TReverseIterator<ConstIterator>;
|
||||
@ -905,7 +905,7 @@ public:
|
||||
|
||||
FORCEINLINE Reference& operator=(bool InValue) { Data = (Data & ~Mask) | (InValue ? Mask : 0); return *this; }
|
||||
|
||||
FORCEINLINE Reference& operator=(const Reference& InValue) { return *this = static_cast<bool>(InValue); }
|
||||
FORCEINLINE Reference& operator=(const Reference& InValue) { *this = static_cast<bool>(InValue); return *this; }
|
||||
|
||||
FORCEINLINE Reference& operator&=(bool InValue) { Data &= InValue ? -1 : ~Mask; return *this; }
|
||||
FORCEINLINE Reference& operator|=(bool InValue) { Data |= InValue ? Mask : 0; return *this; }
|
||||
@ -931,55 +931,53 @@ public:
|
||||
private:
|
||||
|
||||
template <bool bConst>
|
||||
class IteratorImpl
|
||||
class TIteratorImpl
|
||||
{
|
||||
private:
|
||||
|
||||
public:
|
||||
|
||||
using ElementType = TConditional<bConst, const bool, bool>;
|
||||
using ElementType = bool;
|
||||
|
||||
FORCEINLINE IteratorImpl() = default;
|
||||
FORCEINLINE TIteratorImpl() = default;
|
||||
|
||||
# if DO_CHECK
|
||||
FORCEINLINE IteratorImpl(const IteratorImpl<false>& InValue) requires (bConst)
|
||||
: Owner(InValue.Owner), Pointer(InValue.Pointer), Offset(InValue.Offset)
|
||||
FORCEINLINE TIteratorImpl(const TIteratorImpl<false>& InValue) requires (bConst)
|
||||
: Owner(InValue.Owner), Pointer(InValue.Pointer), BitOffset(InValue.BitOffset)
|
||||
{ }
|
||||
# else
|
||||
FORCEINLINE IteratorImpl(const IteratorImpl<false>& InValue) requires (bConst)
|
||||
: Pointer(InValue.Pointer), Offset(InValue.Offset)
|
||||
FORCEINLINE TIteratorImpl(const TIteratorImpl<false>& InValue) requires (bConst)
|
||||
: Pointer(InValue.Pointer), BitOffset(InValue.BitOffset)
|
||||
{ }
|
||||
# endif
|
||||
|
||||
FORCEINLINE IteratorImpl(const IteratorImpl&) = default;
|
||||
FORCEINLINE IteratorImpl(IteratorImpl&&) = default;
|
||||
FORCEINLINE IteratorImpl& operator=(const IteratorImpl&) = default;
|
||||
FORCEINLINE IteratorImpl& operator=(IteratorImpl&&) = default;
|
||||
FORCEINLINE TIteratorImpl(const TIteratorImpl&) = default;
|
||||
FORCEINLINE TIteratorImpl(TIteratorImpl&&) = default;
|
||||
FORCEINLINE TIteratorImpl& operator=(const TIteratorImpl&) = default;
|
||||
FORCEINLINE TIteratorImpl& operator=(TIteratorImpl&&) = default;
|
||||
|
||||
NODISCARD friend FORCEINLINE bool operator==(const IteratorImpl& LHS, const IteratorImpl& RHS) { check(LHS.Pointer == RHS.Pointer); return LHS.Offset == RHS.Offset; }
|
||||
NODISCARD friend FORCEINLINE bool operator==(const TIteratorImpl& LHS, const TIteratorImpl& RHS) { check(LHS.Pointer == RHS.Pointer); return LHS.BitOffset == RHS.BitOffset; }
|
||||
|
||||
NODISCARD friend FORCEINLINE strong_ordering operator<=>(const IteratorImpl& LHS, const IteratorImpl& RHS) { check(LHS.Pointer == RHS.Pointer); return LHS.Offset <=> RHS.Offset; }
|
||||
NODISCARD friend FORCEINLINE strong_ordering operator<=>(const TIteratorImpl& LHS, const TIteratorImpl& RHS) { check(LHS.Pointer == RHS.Pointer); return LHS.BitOffset <=> RHS.BitOffset; }
|
||||
|
||||
NODISCARD FORCEINLINE Reference operator*() const requires (!bConst) { CheckThis(true); return Reference(*(Pointer + Offset / BlockWidth), 1ull << Offset % BlockWidth); }
|
||||
NODISCARD FORCEINLINE ConstReference operator*() const requires ( bConst) { CheckThis(true); return (*(Pointer + Offset / BlockWidth) & (1ull << Offset % BlockWidth)); }
|
||||
NODISCARD FORCEINLINE Reference operator*() const requires (!bConst) { CheckThis(true); return Reference(*(Pointer + BitOffset / BlockWidth), 1ull << BitOffset % BlockWidth); }
|
||||
NODISCARD FORCEINLINE ConstReference operator*() const requires ( bConst) { CheckThis(true); return (*(Pointer + BitOffset / BlockWidth) & (1ull << BitOffset % BlockWidth)); }
|
||||
|
||||
NODISCARD FORCEINLINE auto operator[](ptrdiff Index) const { IteratorImpl Temp = *this + Index; return *Temp; }
|
||||
NODISCARD FORCEINLINE auto operator[](ptrdiff Index) const { TIteratorImpl Temp = *this + Index; return *Temp; }
|
||||
|
||||
FORCEINLINE IteratorImpl& operator++() { ++Offset; CheckThis(); return *this; }
|
||||
FORCEINLINE IteratorImpl& operator--() { --Offset; CheckThis(); return *this; }
|
||||
FORCEINLINE TIteratorImpl& operator++() { ++BitOffset; CheckThis(); return *this; }
|
||||
FORCEINLINE TIteratorImpl& operator--() { --BitOffset; CheckThis(); return *this; }
|
||||
|
||||
FORCEINLINE IteratorImpl operator++(int) { IteratorImpl Temp = *this; ++*this; return Temp; }
|
||||
FORCEINLINE IteratorImpl operator--(int) { IteratorImpl Temp = *this; --*this; return Temp; }
|
||||
FORCEINLINE TIteratorImpl operator++(int) { TIteratorImpl Temp = *this; ++*this; return Temp; }
|
||||
FORCEINLINE TIteratorImpl operator--(int) { TIteratorImpl Temp = *this; --*this; return Temp; }
|
||||
|
||||
FORCEINLINE IteratorImpl& operator+=(ptrdiff Offset) { this->Offset += Offset; CheckThis(); return *this; }
|
||||
FORCEINLINE IteratorImpl& operator-=(ptrdiff Offset) { this->Offset -= Offset; CheckThis(); return *this; }
|
||||
FORCEINLINE TIteratorImpl& operator+=(ptrdiff Offset) { BitOffset += Offset; CheckThis(); return *this; }
|
||||
FORCEINLINE TIteratorImpl& operator-=(ptrdiff Offset) { BitOffset -= Offset; CheckThis(); return *this; }
|
||||
|
||||
NODISCARD friend FORCEINLINE IteratorImpl operator+(IteratorImpl Iter, ptrdiff Offset) { IteratorImpl Temp = Iter; Temp += Offset; return Temp; }
|
||||
NODISCARD friend FORCEINLINE IteratorImpl operator+(ptrdiff Offset, IteratorImpl Iter) { IteratorImpl Temp = Iter; Temp += Offset; return Temp; }
|
||||
NODISCARD friend FORCEINLINE TIteratorImpl operator+(TIteratorImpl Iter, ptrdiff Offset) { TIteratorImpl Temp = Iter; Temp += Offset; return Temp; }
|
||||
NODISCARD friend FORCEINLINE TIteratorImpl operator+(ptrdiff Offset, TIteratorImpl Iter) { TIteratorImpl Temp = Iter; Temp += Offset; return Temp; }
|
||||
|
||||
NODISCARD FORCEINLINE IteratorImpl operator-(ptrdiff Offset) const { IteratorImpl Temp = *this; Temp -= Offset; return Temp; }
|
||||
NODISCARD FORCEINLINE TIteratorImpl operator-(ptrdiff Offset) const { TIteratorImpl Temp = *this; Temp -= Offset; return Temp; }
|
||||
|
||||
NODISCARD friend FORCEINLINE ptrdiff operator-(const IteratorImpl& LHS, const IteratorImpl& RHS) { check(LHS.Pointer == RHS.Pointer); return LHS.Offset - RHS.Offset; }
|
||||
NODISCARD friend FORCEINLINE ptrdiff operator-(const TIteratorImpl& LHS, const TIteratorImpl& RHS) { check(LHS.Pointer == RHS.Pointer); return LHS.BitOffset - RHS.BitOffset; }
|
||||
|
||||
private:
|
||||
|
||||
@ -989,16 +987,16 @@ private:
|
||||
|
||||
using BlockPtr = TConditional<bConst, const BlockType*, BlockType*>;
|
||||
|
||||
BlockPtr Pointer = nullptr;
|
||||
size_t Offset = 0;
|
||||
BlockPtr Pointer = nullptr;
|
||||
size_t BitOffset = 0;
|
||||
|
||||
# if DO_CHECK
|
||||
FORCEINLINE IteratorImpl(const TBitset* InContainer, BlockPtr InPointer, size_t InOffset)
|
||||
: Owner(InContainer), Pointer(InPointer), Offset(InOffset)
|
||||
FORCEINLINE TIteratorImpl(const TBitset* InContainer, BlockPtr InPointer, size_t Offset)
|
||||
: Owner(InContainer), Pointer(InPointer), BitOffset(Offset)
|
||||
{ }
|
||||
# else
|
||||
FORCEINLINE IteratorImpl(const TBitset* InContainer, BlockPtr InPointer, size_t InOffset)
|
||||
: Pointer(InPointer), Offset(InOffset)
|
||||
FORCEINLINE TIteratorImpl(const TBitset* InContainer, BlockPtr InPointer, size_t Offset)
|
||||
: Pointer(InPointer), BitOffset(Offset)
|
||||
{ }
|
||||
# endif
|
||||
|
||||
@ -1008,7 +1006,7 @@ private:
|
||||
checkf(!(bExceptEnd && Owner->End() == *this), TEXT("Read access violation. Please check IsValidIterator()."));
|
||||
}
|
||||
|
||||
template <bool> friend class IteratorImpl;
|
||||
template <bool> friend class TIteratorImpl;
|
||||
|
||||
friend TBitset;
|
||||
|
||||
|
@ -19,7 +19,7 @@ template <typename T> using WithReference = T&;
|
||||
|
||||
template <typename I> struct TIteratorElementType { using Type = typename I::ElementType; };
|
||||
|
||||
template <typename T> struct TIteratorElementType<T*> { using Type = T; };
|
||||
template <typename T> struct TIteratorElementType<T*> { using Type = TRemoveCV<T>; };
|
||||
|
||||
template <typename I> struct TIteratorPointerType { using Type = void; };
|
||||
|
||||
@ -58,6 +58,7 @@ concept CIndirectlyReadable =
|
||||
{ *Iter } -> CSameAs<TIteratorReferenceType<I>>;
|
||||
{ MoveTemp(*Iter) } -> CSameAs<TIteratorRValueReferenceType<I>>;
|
||||
}
|
||||
&& CSameAs<TIteratorElementType<I>, TRemoveCVRef<TIteratorElementType<I>>>
|
||||
&& CCommonReference<TIteratorReferenceType<I>&&, TIteratorElementType<I>&>
|
||||
&& CCommonReference<TIteratorReferenceType<I>&&, TIteratorRValueReferenceType<I>&&>
|
||||
&& CCommonReference<TIteratorRValueReferenceType<I>&&, const TIteratorElementType<I>&>;
|
||||
@ -124,10 +125,9 @@ concept CRandomAccessIterator = CBidirectionalIterator<I> && CTotallyOrdered<I>
|
||||
|
||||
template <typename I>
|
||||
concept CContiguousIterator = CRandomAccessIterator<I> && CLValueReference<TIteratorReferenceType<I>>
|
||||
&& CSameAs<TIteratorElementType<I>, TRemoveReference<TIteratorReferenceType<I>>>
|
||||
&& CSameAs<TIteratorElementType<I>, TRemoveCVRef<TIteratorReferenceType<I>>>
|
||||
&& requires(I& Iter)
|
||||
{
|
||||
static_cast<TObserverPtr<TIteratorElementType<I>[]>>(Iter);
|
||||
{ AddressOf(*Iter) } -> CSameAs<TAddPointer<TIteratorReferenceType<I>>>;
|
||||
};
|
||||
|
||||
|
@ -24,8 +24,8 @@ private:
|
||||
|
||||
struct FNode;
|
||||
|
||||
template <bool bConst>
|
||||
class IteratorImpl;
|
||||
template <bool bConst, typename = TConditional<bConst, const T, T>>
|
||||
class TIteratorImpl;
|
||||
|
||||
public:
|
||||
|
||||
@ -35,8 +35,8 @@ public:
|
||||
using Reference = T&;
|
||||
using ConstReference = const T&;
|
||||
|
||||
using Iterator = IteratorImpl<false>;
|
||||
using ConstIterator = IteratorImpl<true >;
|
||||
using Iterator = TIteratorImpl<false>;
|
||||
using ConstIterator = TIteratorImpl<true >;
|
||||
|
||||
using ReverseIterator = TReverseIterator< Iterator>;
|
||||
using ConstReverseIterator = TReverseIterator<ConstIterator>;
|
||||
@ -553,44 +553,44 @@ private:
|
||||
}
|
||||
ALLOCATOR_WRAPPER_END(AllocatorType, FNode, Impl)
|
||||
|
||||
template <bool bConst>
|
||||
class IteratorImpl
|
||||
template <bool bConst, typename U>
|
||||
class TIteratorImpl
|
||||
{
|
||||
public:
|
||||
|
||||
using ElementType = TConditional<bConst, const T, T>;
|
||||
using ElementType = TRemoveCV<T>;
|
||||
|
||||
FORCEINLINE IteratorImpl() = default;
|
||||
FORCEINLINE TIteratorImpl() = default;
|
||||
|
||||
FORCEINLINE IteratorImpl(const IteratorImpl<false>& InValue) requires (bConst)
|
||||
FORCEINLINE TIteratorImpl(const TIteratorImpl<false>& InValue) requires (bConst)
|
||||
: Pointer(InValue.Pointer)
|
||||
{ }
|
||||
|
||||
FORCEINLINE IteratorImpl(const IteratorImpl&) = default;
|
||||
FORCEINLINE IteratorImpl(IteratorImpl&&) = default;
|
||||
FORCEINLINE IteratorImpl& operator=(const IteratorImpl&) = default;
|
||||
FORCEINLINE IteratorImpl& operator=(IteratorImpl&&) = default;
|
||||
FORCEINLINE TIteratorImpl(const TIteratorImpl&) = default;
|
||||
FORCEINLINE TIteratorImpl(TIteratorImpl&&) = default;
|
||||
FORCEINLINE TIteratorImpl& operator=(const TIteratorImpl&) = default;
|
||||
FORCEINLINE TIteratorImpl& operator=(TIteratorImpl&&) = default;
|
||||
|
||||
NODISCARD friend FORCEINLINE bool operator==(const IteratorImpl& LHS, const IteratorImpl& RHS) { return LHS.Pointer == RHS.Pointer; }
|
||||
NODISCARD friend FORCEINLINE bool operator==(const TIteratorImpl& LHS, const TIteratorImpl& RHS) { return LHS.Pointer == RHS.Pointer; }
|
||||
|
||||
NODISCARD FORCEINLINE ElementType& operator*() const { return Pointer->Value; }
|
||||
NODISCARD FORCEINLINE ElementType* operator->() const { return &Pointer->Value; }
|
||||
NODISCARD FORCEINLINE U& operator*() const { return Pointer->Value; }
|
||||
NODISCARD FORCEINLINE U* operator->() const { return &Pointer->Value; }
|
||||
|
||||
FORCEINLINE IteratorImpl& operator++() { Pointer = Pointer->NextNode; return *this; }
|
||||
FORCEINLINE IteratorImpl& operator--() { Pointer = Pointer->PrevNode; return *this; }
|
||||
FORCEINLINE TIteratorImpl& operator++() { Pointer = Pointer->NextNode; return *this; }
|
||||
FORCEINLINE TIteratorImpl& operator--() { Pointer = Pointer->PrevNode; return *this; }
|
||||
|
||||
FORCEINLINE IteratorImpl operator++(int) { IteratorImpl Temp = *this; ++*this; return Temp; }
|
||||
FORCEINLINE IteratorImpl operator--(int) { IteratorImpl Temp = *this; --*this; return Temp; }
|
||||
FORCEINLINE TIteratorImpl operator++(int) { TIteratorImpl Temp = *this; ++*this; return Temp; }
|
||||
FORCEINLINE TIteratorImpl operator--(int) { TIteratorImpl Temp = *this; --*this; return Temp; }
|
||||
|
||||
private:
|
||||
|
||||
FNode* Pointer = nullptr;
|
||||
|
||||
FORCEINLINE IteratorImpl(FNode* InPointer)
|
||||
FORCEINLINE TIteratorImpl(FNode* InPointer)
|
||||
: Pointer(InPointer)
|
||||
{ }
|
||||
|
||||
template <bool> friend class IteratorImpl;
|
||||
template <bool, typename> friend class TIteratorImpl;
|
||||
|
||||
friend TList;
|
||||
|
||||
|
@ -21,8 +21,8 @@ struct TStaticArray final
|
||||
{
|
||||
private:
|
||||
|
||||
template <bool bConst>
|
||||
class IteratorImpl;
|
||||
template <bool bConst, typename = TConditional<bConst, const T, T>>
|
||||
class TIteratorImpl;
|
||||
|
||||
public:
|
||||
|
||||
@ -31,8 +31,8 @@ public:
|
||||
using Reference = T&;
|
||||
using ConstReference = const T&;
|
||||
|
||||
using Iterator = IteratorImpl<false>;
|
||||
using ConstIterator = IteratorImpl<true >;
|
||||
using Iterator = TIteratorImpl<false>;
|
||||
using ConstIterator = TIteratorImpl<true >;
|
||||
|
||||
using ReverseIterator = TReverseIterator< Iterator>;
|
||||
using ConstReverseIterator = TReverseIterator<ConstIterator>;
|
||||
@ -123,56 +123,56 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
template <bool bConst>
|
||||
class IteratorImpl
|
||||
template <bool bConst, typename U>
|
||||
class TIteratorImpl
|
||||
{
|
||||
public:
|
||||
|
||||
using ElementType = TConditional<bConst, const T, T>;
|
||||
using ElementType = TRemoveCV<T>;
|
||||
|
||||
FORCEINLINE constexpr IteratorImpl() = default;
|
||||
FORCEINLINE constexpr TIteratorImpl() = default;
|
||||
|
||||
# if DO_CHECK
|
||||
FORCEINLINE IteratorImpl(const IteratorImpl<false>& InValue) requires (bConst)
|
||||
FORCEINLINE TIteratorImpl(const TIteratorImpl<false>& InValue) requires (bConst)
|
||||
: Owner(InValue.Owner), Pointer(InValue.Pointer)
|
||||
{ }
|
||||
# else
|
||||
FORCEINLINE IteratorImpl(const IteratorImpl<false>& InValue) requires (bConst)
|
||||
FORCEINLINE TIteratorImpl(const TIteratorImpl<false>& InValue) requires (bConst)
|
||||
: Pointer(InValue.Pointer)
|
||||
{ }
|
||||
# endif
|
||||
|
||||
FORCEINLINE constexpr IteratorImpl(const IteratorImpl&) = default;
|
||||
FORCEINLINE constexpr IteratorImpl(IteratorImpl&&) = default;
|
||||
FORCEINLINE constexpr IteratorImpl& operator=(const IteratorImpl&) = default;
|
||||
FORCEINLINE constexpr IteratorImpl& operator=(IteratorImpl&&) = default;
|
||||
FORCEINLINE constexpr TIteratorImpl(const TIteratorImpl&) = default;
|
||||
FORCEINLINE constexpr TIteratorImpl(TIteratorImpl&&) = default;
|
||||
FORCEINLINE constexpr TIteratorImpl& operator=(const TIteratorImpl&) = default;
|
||||
FORCEINLINE constexpr TIteratorImpl& operator=(TIteratorImpl&&) = default;
|
||||
|
||||
NODISCARD friend FORCEINLINE constexpr bool operator==(const IteratorImpl& LHS, const IteratorImpl& RHS) { return LHS.Pointer == RHS.Pointer; }
|
||||
NODISCARD friend FORCEINLINE constexpr bool operator==(const TIteratorImpl& LHS, const TIteratorImpl& RHS) { return LHS.Pointer == RHS.Pointer; }
|
||||
|
||||
NODISCARD friend FORCEINLINE constexpr strong_ordering operator<=>(const IteratorImpl& LHS, const IteratorImpl& RHS) { return LHS.Pointer <=> RHS.Pointer; }
|
||||
NODISCARD friend FORCEINLINE constexpr strong_ordering operator<=>(const TIteratorImpl& LHS, const TIteratorImpl& RHS) { return LHS.Pointer <=> RHS.Pointer; }
|
||||
|
||||
NODISCARD FORCEINLINE constexpr ElementType& operator*() const { CheckThis(true); return *Pointer; }
|
||||
NODISCARD FORCEINLINE constexpr ElementType* operator->() const { CheckThis(true); return Pointer; }
|
||||
NODISCARD FORCEINLINE constexpr U& operator*() const { CheckThis(true); return *Pointer; }
|
||||
NODISCARD FORCEINLINE constexpr U* operator->() const { CheckThis(true); return Pointer; }
|
||||
|
||||
NODISCARD FORCEINLINE constexpr ElementType& operator[](ptrdiff Index) const { IteratorImpl Temp = *this + Index; return *Temp; }
|
||||
NODISCARD FORCEINLINE constexpr U& operator[](ptrdiff Index) const { TIteratorImpl Temp = *this + Index; return *Temp; }
|
||||
|
||||
FORCEINLINE constexpr IteratorImpl& operator++() { ++Pointer; CheckThis(); return *this; }
|
||||
FORCEINLINE constexpr IteratorImpl& operator--() { --Pointer; CheckThis(); return *this; }
|
||||
FORCEINLINE constexpr TIteratorImpl& operator++() { ++Pointer; CheckThis(); return *this; }
|
||||
FORCEINLINE constexpr TIteratorImpl& operator--() { --Pointer; CheckThis(); return *this; }
|
||||
|
||||
FORCEINLINE constexpr IteratorImpl operator++(int) { IteratorImpl Temp = *this; ++*this; return Temp; }
|
||||
FORCEINLINE constexpr IteratorImpl operator--(int) { IteratorImpl Temp = *this; --*this; return Temp; }
|
||||
FORCEINLINE constexpr TIteratorImpl operator++(int) { TIteratorImpl Temp = *this; ++*this; return Temp; }
|
||||
FORCEINLINE constexpr TIteratorImpl operator--(int) { TIteratorImpl Temp = *this; --*this; return Temp; }
|
||||
|
||||
FORCEINLINE constexpr IteratorImpl& operator+=(ptrdiff Offset) { Pointer += Offset; CheckThis(); return *this; }
|
||||
FORCEINLINE constexpr IteratorImpl& operator-=(ptrdiff Offset) { Pointer -= Offset; CheckThis(); return *this; }
|
||||
FORCEINLINE constexpr TIteratorImpl& operator+=(ptrdiff Offset) { Pointer += Offset; CheckThis(); return *this; }
|
||||
FORCEINLINE constexpr TIteratorImpl& operator-=(ptrdiff Offset) { Pointer -= Offset; CheckThis(); return *this; }
|
||||
|
||||
NODISCARD friend FORCEINLINE constexpr IteratorImpl operator+(IteratorImpl Iter, ptrdiff Offset) { IteratorImpl Temp = Iter; Temp += Offset; return Temp; }
|
||||
NODISCARD friend FORCEINLINE constexpr IteratorImpl operator+(ptrdiff Offset, IteratorImpl Iter) { IteratorImpl Temp = Iter; Temp += Offset; return Temp; }
|
||||
NODISCARD friend FORCEINLINE constexpr TIteratorImpl operator+(TIteratorImpl Iter, ptrdiff Offset) { TIteratorImpl Temp = Iter; Temp += Offset; return Temp; }
|
||||
NODISCARD friend FORCEINLINE constexpr TIteratorImpl operator+(ptrdiff Offset, TIteratorImpl Iter) { TIteratorImpl Temp = Iter; Temp += Offset; return Temp; }
|
||||
|
||||
NODISCARD FORCEINLINE constexpr IteratorImpl operator-(ptrdiff Offset) const { IteratorImpl Temp = *this; Temp -= Offset; return Temp; }
|
||||
NODISCARD FORCEINLINE constexpr TIteratorImpl operator-(ptrdiff Offset) const { TIteratorImpl Temp = *this; Temp -= Offset; return Temp; }
|
||||
|
||||
NODISCARD friend FORCEINLINE constexpr ptrdiff operator-(const IteratorImpl& LHS, const IteratorImpl& RHS) { LHS.CheckThis(); RHS.CheckThis(); return LHS.Pointer - RHS.Pointer; }
|
||||
NODISCARD friend FORCEINLINE constexpr ptrdiff operator-(const TIteratorImpl& LHS, const TIteratorImpl& RHS) { LHS.CheckThis(); RHS.CheckThis(); return LHS.Pointer - RHS.Pointer; }
|
||||
|
||||
NODISCARD FORCEINLINE constexpr explicit operator TObserverPtr<ElementType[]>() const { CheckThis(); return TObserverPtr<ElementType[]>(Pointer); }
|
||||
NODISCARD FORCEINLINE constexpr explicit operator TObserverPtr<U[]>() const { CheckThis(); return TObserverPtr<U[]>(Pointer); }
|
||||
|
||||
private:
|
||||
|
||||
@ -180,14 +180,14 @@ private:
|
||||
const TStaticArray* Owner = nullptr;
|
||||
# endif
|
||||
|
||||
ElementType* Pointer = nullptr;
|
||||
U* Pointer = nullptr;
|
||||
|
||||
# if DO_CHECK
|
||||
FORCEINLINE constexpr IteratorImpl(const TStaticArray* InContainer, ElementType* InPointer)
|
||||
FORCEINLINE constexpr TIteratorImpl(const TStaticArray* InContainer, U* InPointer)
|
||||
: Owner(InContainer), Pointer(InPointer)
|
||||
{ }
|
||||
# else
|
||||
FORCEINLINE constexpr IteratorImpl(const TStaticArray* InContainer, ElementType* InPointer)
|
||||
FORCEINLINE constexpr TIteratorImpl(const TStaticArray* InContainer, U* InPointer)
|
||||
: Pointer(InPointer)
|
||||
{ }
|
||||
# endif
|
||||
@ -198,7 +198,7 @@ private:
|
||||
checkf(!(bExceptEnd && Owner->End() == *this), TEXT("Read access violation. Please check IsValidIterator()."));
|
||||
}
|
||||
|
||||
template <bool> friend class IteratorImpl;
|
||||
template <bool, typename> friend class TIteratorImpl;
|
||||
|
||||
friend TStaticArray;
|
||||
|
||||
|
@ -33,7 +33,7 @@ class TStaticBitset final
|
||||
private:
|
||||
|
||||
template <bool bConst>
|
||||
class IteratorImpl;
|
||||
class TIteratorImpl;
|
||||
|
||||
public:
|
||||
|
||||
@ -43,8 +43,8 @@ public:
|
||||
class Reference;
|
||||
using ConstReference = bool;
|
||||
|
||||
using Iterator = IteratorImpl<false>;
|
||||
using ConstIterator = IteratorImpl<true >;
|
||||
using Iterator = TIteratorImpl<false>;
|
||||
using ConstIterator = TIteratorImpl<true >;
|
||||
|
||||
using ReverseIterator = TReverseIterator< Iterator>;
|
||||
using ConstReverseIterator = TReverseIterator<ConstIterator>;
|
||||
@ -115,7 +115,7 @@ public:
|
||||
|
||||
/** Move assignment operator. After the move, 'InValue' is guaranteed to be empty. */
|
||||
FORCEINLINE constexpr TStaticBitset& operator=(TStaticBitset&&) = default;
|
||||
|
||||
|
||||
/** Compares the bits of two bitsets. */
|
||||
NODISCARD friend constexpr bool operator==(const TStaticBitset& LHS, const TStaticBitset& RHS)
|
||||
{
|
||||
@ -399,7 +399,7 @@ public:
|
||||
uint64 Result = 0;
|
||||
|
||||
static_assert(sizeof(BlockType) <= sizeof(uint64), "The block width of TStaticBitset is unexpected");
|
||||
|
||||
|
||||
if constexpr (sizeof(BlockType) == sizeof(uint8))
|
||||
{
|
||||
if constexpr (N > 0) Result |= static_cast<uint64>(Impl[0]) << 0;
|
||||
@ -506,7 +506,7 @@ public:
|
||||
|
||||
FORCEINLINE constexpr Reference& operator=(bool InValue) { Data = (Data & ~Mask) | (InValue ? Mask : 0); return *this; }
|
||||
|
||||
FORCEINLINE constexpr Reference& operator=(const Reference& InValue) { return *this = static_cast<bool>(InValue); }
|
||||
FORCEINLINE constexpr Reference& operator=(const Reference& InValue) { *this = static_cast<bool>(InValue); return *this; }
|
||||
|
||||
FORCEINLINE constexpr Reference& operator&=(bool InValue) { Data &= InValue ? -1 : ~Mask; return *this; }
|
||||
FORCEINLINE constexpr Reference& operator|=(bool InValue) { Data |= InValue ? Mask : 0; return *this; }
|
||||
@ -532,55 +532,55 @@ public:
|
||||
private:
|
||||
|
||||
template <bool bConst>
|
||||
class IteratorImpl
|
||||
class TIteratorImpl
|
||||
{
|
||||
private:
|
||||
|
||||
public:
|
||||
|
||||
using ElementType = TConditional<bConst, const bool, bool>;
|
||||
using ElementType = bool;
|
||||
|
||||
FORCEINLINE constexpr IteratorImpl() = default;
|
||||
FORCEINLINE constexpr TIteratorImpl() = default;
|
||||
|
||||
# if DO_CHECK
|
||||
FORCEINLINE constexpr IteratorImpl(const IteratorImpl<false>& InValue) requires (bConst)
|
||||
: Owner(InValue.Owner), Pointer(InValue.Pointer), Offset(InValue.Offset)
|
||||
FORCEINLINE constexpr TIteratorImpl(const TIteratorImpl<false>& InValue) requires (bConst)
|
||||
: Owner(InValue.Owner), Pointer(InValue.Pointer), BitOffset(InValue.BitOffset)
|
||||
{ }
|
||||
# else
|
||||
FORCEINLINE constexpr IteratorImpl(const IteratorImpl<false>& InValue) requires (bConst)
|
||||
: Pointer(InValue.Pointer), Offset(InValue.Offset)
|
||||
FORCEINLINE constexpr TIteratorImpl(const TIteratorImpl<false>& InValue) requires (bConst)
|
||||
: Pointer(InValue.Pointer), BitOffset(InValue.BitOffset)
|
||||
{ }
|
||||
# endif
|
||||
|
||||
FORCEINLINE constexpr IteratorImpl(const IteratorImpl&) = default;
|
||||
FORCEINLINE constexpr IteratorImpl(IteratorImpl&&) = default;
|
||||
FORCEINLINE constexpr IteratorImpl& operator=(const IteratorImpl&) = default;
|
||||
FORCEINLINE constexpr IteratorImpl& operator=(IteratorImpl&&) = default;
|
||||
FORCEINLINE constexpr TIteratorImpl(const TIteratorImpl&) = default;
|
||||
FORCEINLINE constexpr TIteratorImpl(TIteratorImpl&&) = default;
|
||||
FORCEINLINE constexpr TIteratorImpl& operator=(const TIteratorImpl&) = default;
|
||||
FORCEINLINE constexpr TIteratorImpl& operator=(TIteratorImpl&&) = default;
|
||||
|
||||
NODISCARD friend FORCEINLINE constexpr bool operator==(const IteratorImpl& LHS, const IteratorImpl& RHS) { check(LHS.Pointer == RHS.Pointer); return LHS.Offset == RHS.Offset; }
|
||||
NODISCARD friend FORCEINLINE constexpr bool operator==(const TIteratorImpl& LHS, const TIteratorImpl& RHS) { check(LHS.Pointer == RHS.Pointer); return LHS.BitOffset == RHS.BitOffset; }
|
||||
|
||||
NODISCARD friend FORCEINLINE constexpr strong_ordering operator<=>(const IteratorImpl& LHS, const IteratorImpl& RHS) { check(LHS.Pointer == RHS.Pointer); return LHS.Offset <=> RHS.Offset; }
|
||||
NODISCARD friend FORCEINLINE constexpr strong_ordering operator<=>(const TIteratorImpl& LHS, const TIteratorImpl& RHS) { check(LHS.Pointer == RHS.Pointer); return LHS.BitOffset <=> RHS.BitOffset; }
|
||||
|
||||
NODISCARD FORCEINLINE constexpr Reference operator*() const requires (!bConst) { CheckThis(true); return Reference(*(Pointer + Offset / BlockWidth), 1ull << Offset % BlockWidth); }
|
||||
NODISCARD FORCEINLINE constexpr ConstReference operator*() const requires ( bConst) { CheckThis(true); return (*(Pointer + Offset / BlockWidth) & (1ull << Offset % BlockWidth)); }
|
||||
NODISCARD FORCEINLINE constexpr Reference operator*() const requires (!bConst) { CheckThis(true); return Reference(*(Pointer + BitOffset / BlockWidth), 1ull << BitOffset % BlockWidth); }
|
||||
NODISCARD FORCEINLINE constexpr ConstReference operator*() const requires ( bConst) { CheckThis(true); return (*(Pointer + BitOffset / BlockWidth) & (1ull << BitOffset % BlockWidth)); }
|
||||
|
||||
NODISCARD FORCEINLINE constexpr auto operator[](ptrdiff Index) const { IteratorImpl Temp = *this + Index; return *Temp; }
|
||||
NODISCARD FORCEINLINE constexpr auto operator[](ptrdiff Index) const { TIteratorImpl Temp = *this + Index; return *Temp; }
|
||||
|
||||
FORCEINLINE constexpr IteratorImpl& operator++() { ++Offset; CheckThis(); return *this; }
|
||||
FORCEINLINE constexpr IteratorImpl& operator--() { --Offset; CheckThis(); return *this; }
|
||||
FORCEINLINE constexpr TIteratorImpl& operator++() { ++BitOffset; CheckThis(); return *this; }
|
||||
FORCEINLINE constexpr TIteratorImpl& operator--() { --BitOffset; CheckThis(); return *this; }
|
||||
|
||||
FORCEINLINE constexpr IteratorImpl operator++(int) { IteratorImpl Temp = *this; ++*this; return Temp; }
|
||||
FORCEINLINE constexpr IteratorImpl operator--(int) { IteratorImpl Temp = *this; --*this; return Temp; }
|
||||
FORCEINLINE constexpr TIteratorImpl operator++(int) { TIteratorImpl Temp = *this; ++*this; return Temp; }
|
||||
FORCEINLINE constexpr TIteratorImpl operator--(int) { TIteratorImpl Temp = *this; --*this; return Temp; }
|
||||
|
||||
FORCEINLINE constexpr IteratorImpl& operator+=(ptrdiff Offset) { this->Offset += Offset; CheckThis(); return *this; }
|
||||
FORCEINLINE constexpr IteratorImpl& operator-=(ptrdiff Offset) { this->Offset -= Offset; CheckThis(); return *this; }
|
||||
FORCEINLINE constexpr TIteratorImpl& operator+=(ptrdiff Offset) { BitOffset += Offset; CheckThis(); return *this; }
|
||||
FORCEINLINE constexpr TIteratorImpl& operator-=(ptrdiff Offset) { BitOffset -= Offset; CheckThis(); return *this; }
|
||||
|
||||
NODISCARD friend FORCEINLINE constexpr IteratorImpl operator+(IteratorImpl Iter, ptrdiff Offset) { IteratorImpl Temp = Iter; Temp += Offset; return Temp; }
|
||||
NODISCARD friend FORCEINLINE constexpr IteratorImpl operator+(ptrdiff Offset, IteratorImpl Iter) { IteratorImpl Temp = Iter; Temp += Offset; return Temp; }
|
||||
NODISCARD friend FORCEINLINE constexpr TIteratorImpl operator+(TIteratorImpl Iter, ptrdiff Offset) { TIteratorImpl Temp = Iter; Temp += Offset; return Temp; }
|
||||
NODISCARD friend FORCEINLINE constexpr TIteratorImpl operator+(ptrdiff Offset, TIteratorImpl Iter) { TIteratorImpl Temp = Iter; Temp += Offset; return Temp; }
|
||||
|
||||
NODISCARD FORCEINLINE constexpr IteratorImpl operator-(ptrdiff Offset) const { IteratorImpl Temp = *this; Temp -= Offset; return Temp; }
|
||||
NODISCARD FORCEINLINE constexpr TIteratorImpl operator-(ptrdiff Offset) const { TIteratorImpl Temp = *this; Temp -= Offset; return Temp; }
|
||||
|
||||
NODISCARD friend FORCEINLINE constexpr ptrdiff operator-(const IteratorImpl& LHS, const IteratorImpl& RHS) { check(LHS.Pointer == RHS.Pointer); return LHS.Offset - RHS.Offset; }
|
||||
NODISCARD friend FORCEINLINE constexpr ptrdiff operator-(const TIteratorImpl& LHS, const TIteratorImpl& RHS) { check(LHS.Pointer == RHS.Pointer); return LHS.BitOffset - RHS.BitOffset; }
|
||||
|
||||
private:
|
||||
|
||||
@ -590,16 +590,16 @@ private:
|
||||
|
||||
using BlockPtr = TConditional<bConst, const BlockType*, BlockType*>;
|
||||
|
||||
BlockPtr Pointer = nullptr;
|
||||
size_t Offset = 0;
|
||||
BlockPtr Pointer = nullptr;
|
||||
size_t BitOffset = 0;
|
||||
|
||||
# if DO_CHECK
|
||||
FORCEINLINE constexpr IteratorImpl(const TStaticBitset* InContainer, BlockPtr InPointer, size_t InOffset)
|
||||
: Owner(InContainer), Pointer(InPointer), Offset(InOffset)
|
||||
FORCEINLINE constexpr TIteratorImpl(const TStaticBitset* InContainer, BlockPtr InPointer, size_t Offset)
|
||||
: Owner(InContainer), Pointer(InPointer), BitOffset(Offset)
|
||||
{ }
|
||||
# else
|
||||
FORCEINLINE constexpr IteratorImpl(const TStaticBitset* InContainer, BlockPtr InPointer, size_t InOffset)
|
||||
: Pointer(InPointer), Offset(InOffset)
|
||||
FORCEINLINE constexpr TIteratorImpl(const TStaticBitset* InContainer, BlockPtr InPointer, size_t Offset)
|
||||
: Pointer(InPointer), BitOffset(Offset)
|
||||
{ }
|
||||
# endif
|
||||
|
||||
@ -609,7 +609,7 @@ private:
|
||||
checkf(!(bExceptEnd && Owner->End() == *this), TEXT("Read access violation. Please check IsValidIterator()."));
|
||||
}
|
||||
|
||||
template <bool> friend class IteratorImpl;
|
||||
template <bool> friend class TIteratorImpl;
|
||||
|
||||
friend TStaticBitset;
|
||||
|
||||
|
@ -16,7 +16,7 @@ class TConstantIterator final
|
||||
{
|
||||
public:
|
||||
|
||||
using ElementType = T;
|
||||
using ElementType = TRemoveCV<T>;
|
||||
|
||||
FORCEINLINE constexpr TConstantIterator() = default;
|
||||
|
||||
@ -68,7 +68,7 @@ class TConstantIterator<T&> final
|
||||
{
|
||||
public:
|
||||
|
||||
using ElementType = T;
|
||||
using ElementType = TRemoveCV<T>;
|
||||
|
||||
FORCEINLINE constexpr TConstantIterator() = default;
|
||||
|
||||
|
@ -1048,16 +1048,13 @@ private:
|
||||
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
TString(size_t, T) -> TString<T>;
|
||||
|
||||
template<typename T>
|
||||
TString(const T*) -> TString<T>;
|
||||
|
||||
template<typename T>
|
||||
TString(TStringView<T>) -> TString<T>;
|
||||
|
||||
template<typename I, typename S>
|
||||
template<CForwardIterator I, typename S>
|
||||
TString(I, S) -> TString<TIteratorElementType<I>>;
|
||||
|
||||
template <typename T>
|
||||
|
Loading…
Reference in New Issue
Block a user