diff --git a/Redcraft.Utility/Source/Public/Containers/Iterator.h b/Redcraft.Utility/Source/Public/Containers/Iterator.h index fca801c..b07e19d 100644 --- a/Redcraft.Utility/Source/Public/Containers/Iterator.h +++ b/Redcraft.Utility/Source/Public/Containers/Iterator.h @@ -147,7 +147,8 @@ public: FORCEINLINE constexpr TReverseIterator& operator=(const TReverseIterator&) = default; FORCEINLINE constexpr TReverseIterator& operator=(TReverseIterator&&) = default; - FORCEINLINE constexpr explicit TReverseIterator(IteratorType InValue) : Current(InValue) { } + template requires (!CSameAs> && CConstructibleFrom) + FORCEINLINE constexpr explicit TReverseIterator(T&& InValue) : Current(Forward(InValue)) { } template requires (!CSameAs && CConstructibleFrom) FORCEINLINE constexpr explicit (!CConvertibleTo) TReverseIterator(const TReverseIterator& InValue) : Current(InValue.GetBase()) { } @@ -222,7 +223,8 @@ public: FORCEINLINE constexpr TMoveIterator& operator=(const TMoveIterator&) = default; FORCEINLINE constexpr TMoveIterator& operator=(TMoveIterator&&) = default; - FORCEINLINE constexpr explicit TMoveIterator(IteratorType InValue) : Current(InValue) { } + template requires (!CSameAs> && CConstructibleFrom) + FORCEINLINE constexpr explicit TMoveIterator(T&& InValue) : Current(Forward(InValue)) { } template requires (!CSameAs && CConstructibleFrom) FORCEINLINE constexpr explicit (!CConvertibleTo) TMoveIterator(const TMoveIterator& InValue) : Current(InValue.GetBase()) { } @@ -293,7 +295,8 @@ public: FORCEINLINE constexpr TMoveSentinel& operator=(const TMoveSentinel&) = default; FORCEINLINE constexpr TMoveSentinel& operator=(TMoveSentinel&&) = default; - FORCEINLINE constexpr explicit TMoveSentinel(SentinelType InValue) : Last(InValue) { } + template requires (!CSameAs> && CConstructibleFrom) + FORCEINLINE constexpr explicit TMoveSentinel(T&& InValue) : Last(Forward(InValue)) { } template requires (!CSameAs && CConstructibleFrom) FORCEINLINE constexpr explicit (!CConvertibleTo) TMoveSentinel(const TMoveSentinel& InValue) : Last(InValue.GetBase()) { } @@ -368,7 +371,8 @@ public: FORCEINLINE constexpr TCountedIterator& operator=(const TCountedIterator&) = default; FORCEINLINE constexpr TCountedIterator& operator=(TCountedIterator&&) = default; - FORCEINLINE constexpr explicit TCountedIterator(IteratorType InValue, ptrdiff N) : Current(InValue), Length(N) { check_code({ MaxLength = N; }); } + template requires (!CSameAs> && CConstructibleFrom) + FORCEINLINE constexpr explicit TCountedIterator(T&& InValue, ptrdiff N) : Current(Forward(InValue)), Length(N) { check_code({ MaxLength = N; }); } template requires (!CSameAs && CConstructibleFrom) FORCEINLINE constexpr explicit (!CConvertibleTo) TCountedIterator(const TCountedIterator& InValue) : Current(InValue.GetBase()), Length(InValue.Num()) { check_code({ MaxLength = InValue.MaxLength; }); } @@ -462,7 +466,7 @@ public: FORCEINLINE constexpr TFunctionalInputIterator() requires (CDefaultConstructible && CDefaultConstructible) : bIsConsumed(false) { }; - template requires (CConvertibleTo && CConvertibleTo) + template requires (CConstructibleFrom && CConstructibleFrom) FORCEINLINE constexpr TFunctionalInputIterator(T&& InInputer, U&& InSentinel) : InputerStorage(Forward(InInputer)), SentinelStorage(Forward(InSentinel)), bIsConsumed(false) { } NODISCARD FORCEINLINE constexpr bool operator==(FDefaultSentinel) const& { return Invoke(SentinelStorage); } @@ -569,8 +573,8 @@ public: FORCEINLINE constexpr TFunctionalOutputIterator() requires (CDefaultConstructible) { check_code({ bIsProduced = false; }); } - template requires (CConvertibleTo) - FORCEINLINE constexpr TFunctionalOutputIterator(T&& InOutputer) : OutputerStorage(Forward(InOutputer)) { check_code({ bIsProduced = false; }); } + template requires (!CSameAs> && CConstructibleFrom) + FORCEINLINE constexpr explicit TFunctionalOutputIterator(T&& InOutputer) : OutputerStorage(Forward(InOutputer)) { check_code({ bIsProduced = false; }); } NODISCARD FORCEINLINE constexpr FIndirectionProxy operator*() const {