From dd3a366c145ff46e3c5b31559be4244c9eeac8ef Mon Sep 17 00:00:00 2001 From: Redstone1024 <2824517378@qq.com> Date: Thu, 19 Dec 2024 11:49:13 +0800 Subject: [PATCH] fix(*): fix some iterator adapter implementation bugs --- Redcraft.Utility/Source/Public/Iterator/CountedIterator.h | 2 -- Redcraft.Utility/Source/Public/Iterator/MoveIterator.h | 2 +- Redcraft.Utility/Source/Public/Iterator/ReverseIterator.h | 4 ++-- Redcraft.Utility/Source/Public/Range/TransformView.h | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Redcraft.Utility/Source/Public/Iterator/CountedIterator.h b/Redcraft.Utility/Source/Public/Iterator/CountedIterator.h index 9296149..6760681 100644 --- a/Redcraft.Utility/Source/Public/Iterator/CountedIterator.h +++ b/Redcraft.Utility/Source/Public/Iterator/CountedIterator.h @@ -74,8 +74,6 @@ public: NODISCARD FORCEINLINE constexpr bool operator==(FDefaultSentinel) const& { return Length == static_cast(0); } - NODISCARD FORCEINLINE constexpr strong_ordering operator<=>(FDefaultSentinel) const& { return static_cast(0) <=> Length; } - NODISCARD FORCEINLINE constexpr TIteratorReference operator*() { CheckThis(true); return *GetBase(); } NODISCARD FORCEINLINE constexpr TIteratorReference operator*() const requires (CDereferenceable) { CheckThis(true); return *GetBase(); } diff --git a/Redcraft.Utility/Source/Public/Iterator/MoveIterator.h b/Redcraft.Utility/Source/Public/Iterator/MoveIterator.h index ef9e590..39fe2c6 100644 --- a/Redcraft.Utility/Source/Public/Iterator/MoveIterator.h +++ b/Redcraft.Utility/Source/Public/Iterator/MoveIterator.h @@ -47,7 +47,7 @@ public: NODISCARD friend FORCEINLINE constexpr bool operator==(const TMoveIterator& LHS, const TMoveIterator& RHS) { return LHS.GetBase() == RHS.GetBase(); } template requires (CThreeWayComparable) - NODISCARD friend FORCEINLINE constexpr TCompareThreeWayResult operator<=>(const TMoveIterator& LHS, const TMoveIterator& RHS) { return RHS.GetBase() <=> LHS.GetBase(); } + NODISCARD friend FORCEINLINE constexpr TCompareThreeWayResult operator<=>(const TMoveIterator& LHS, const TMoveIterator& RHS) { return LHS.GetBase() <=> RHS.GetBase(); } NODISCARD FORCEINLINE constexpr TIteratorRValueReference operator*() const { return MoveTemp(*GetBase()); } diff --git a/Redcraft.Utility/Source/Public/Iterator/ReverseIterator.h b/Redcraft.Utility/Source/Public/Iterator/ReverseIterator.h index b0f6556..1dc7c9f 100644 --- a/Redcraft.Utility/Source/Public/Iterator/ReverseIterator.h +++ b/Redcraft.Utility/Source/Public/Iterator/ReverseIterator.h @@ -63,8 +63,8 @@ public: FORCEINLINE constexpr TReverseIterator& operator+=(ptrdiff Offset) requires (CRandomAccessIterator) { Current -= Offset; return *this; } FORCEINLINE constexpr TReverseIterator& operator-=(ptrdiff Offset) requires (CRandomAccessIterator) { Current += Offset; return *this; } - NODISCARD FORCEINLINE constexpr TReverseIterator operator+(ptrdiff Offset) const requires (CRandomAccessIterator) { TReverseIterator Temp = *this; Temp -= Offset; return Temp; } - NODISCARD FORCEINLINE constexpr TReverseIterator operator-(ptrdiff Offset) const requires (CRandomAccessIterator) { TReverseIterator Temp = *this; Temp += Offset; return Temp; } + NODISCARD FORCEINLINE constexpr TReverseIterator operator+(ptrdiff Offset) const requires (CRandomAccessIterator) { TReverseIterator Temp = *this; Temp += Offset; return Temp; } + NODISCARD FORCEINLINE constexpr TReverseIterator operator-(ptrdiff Offset) const requires (CRandomAccessIterator) { TReverseIterator Temp = *this; Temp -= Offset; return Temp; } NODISCARD friend FORCEINLINE constexpr TReverseIterator operator+(ptrdiff Offset, const TReverseIterator& Iter) requires (CRandomAccessIterator) { return Iter + Offset; } diff --git a/Redcraft.Utility/Source/Public/Range/TransformView.h b/Redcraft.Utility/Source/Public/Range/TransformView.h index dc4fa38..288f250 100644 --- a/Redcraft.Utility/Source/Public/Range/TransformView.h +++ b/Redcraft.Utility/Source/Public/Range/TransformView.h @@ -175,7 +175,7 @@ private: NODISCARD friend FORCEINLINE constexpr ptrdiff operator-(const FSentinelImpl& LHS, const FIteratorImpl& RHS) requires CSizedSentinelFor, TRangeIterator> { - return RHS.GetBase() - LHS.GetBase(); + return LHS.GetBase() - RHS.GetBase(); } NODISCARD FORCEINLINE constexpr TRangeSentinel GetBase() const { return Current; }