From 38806ca2b660a6a17a7c75a8f2876d8dc6eb1892 Mon Sep 17 00:00:00 2001 From: Redstone1024 <2824517378@qq.com> Date: Tue, 29 Oct 2024 21:07:25 +0800 Subject: [PATCH] fix(containers): fix TCountedIterator::operator- compilation error --- Redcraft.Utility/Source/Public/Containers/Iterator.h | 4 ++-- .../Source/Public/Miscellaneous/ConstantIterator.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Redcraft.Utility/Source/Public/Containers/Iterator.h b/Redcraft.Utility/Source/Public/Containers/Iterator.h index feaf250..add1cab 100644 --- a/Redcraft.Utility/Source/Public/Containers/Iterator.h +++ b/Redcraft.Utility/Source/Public/Containers/Iterator.h @@ -424,8 +424,8 @@ public: template J> NODISCARD friend FORCEINLINE constexpr ptrdiff operator-(const TCountedIterator& LHS, const TCountedIterator& RHS) { LHS.CheckThis(); RHS.CheckThis(); return LHS.Length - RHS.Length; } - NODISCARD friend FORCEINLINE constexpr ptrdiff operator-(const TCountedIterator& LHS, FDefaultSentinel) { CheckThis(); return -LHS.Num(); } - NODISCARD friend FORCEINLINE constexpr ptrdiff operator-(FDefaultSentinel, const TCountedIterator& RHS) { CheckThis(); return RHS.Num(); } + NODISCARD friend FORCEINLINE constexpr ptrdiff operator-(const TCountedIterator& LHS, FDefaultSentinel) { LHS.CheckThis(); return -LHS.Num(); } + NODISCARD friend FORCEINLINE constexpr ptrdiff operator-(FDefaultSentinel, const TCountedIterator& RHS) { RHS.CheckThis(); return RHS.Num(); } NODISCARD FORCEINLINE constexpr explicit operator TObserverPtr() const requires (CContiguousIterator) { CheckThis(); return TObserverPtr(Current); } diff --git a/Redcraft.Utility/Source/Public/Miscellaneous/ConstantIterator.h b/Redcraft.Utility/Source/Public/Miscellaneous/ConstantIterator.h index 2abb58b..a587f94 100644 --- a/Redcraft.Utility/Source/Public/Miscellaneous/ConstantIterator.h +++ b/Redcraft.Utility/Source/Public/Miscellaneous/ConstantIterator.h @@ -176,8 +176,8 @@ public: template J> NODISCARD friend FORCEINLINE constexpr ptrdiff operator-(const TCountedIterator& LHS, const TCountedIterator& RHS) { LHS.CheckThis(); RHS.CheckThis(); return LHS.Length - RHS.Length; } - NODISCARD friend FORCEINLINE constexpr ptrdiff operator-(const TCountedIterator& LHS, FDefaultSentinel) { CheckThis(); return -LHS.Num(); } - NODISCARD friend FORCEINLINE constexpr ptrdiff operator-(FDefaultSentinel, const TCountedIterator& RHS) { CheckThis(); return RHS.Num(); } + NODISCARD friend FORCEINLINE constexpr ptrdiff operator-(const TCountedIterator& LHS, FDefaultSentinel) { LHS.CheckThis(); return -LHS.Num(); } + NODISCARD friend FORCEINLINE constexpr ptrdiff operator-(FDefaultSentinel, const TCountedIterator& RHS) { RHS.CheckThis(); return RHS.Num(); } NODISCARD FORCEINLINE constexpr const IteratorType& GetBase() const& { CheckThis(); return Current; } NODISCARD FORCEINLINE constexpr IteratorType GetBase() && { CheckThis(); return Current; } @@ -204,6 +204,7 @@ private: }; static_assert(CRandomAccessIterator>>); +static_assert(CSizedSentinelFor>>); template requires (CDestructible || CLValueReference) NODISCARD FORCEINLINE constexpr auto MakeConstantIterator(T&& Value)