diff --git a/Redcraft.Utility/Source/Public/Miscellaneous/Iterator.h b/Redcraft.Utility/Source/Public/Miscellaneous/Iterator.h index f43c5a7..b750b46 100644 --- a/Redcraft.Utility/Source/Public/Miscellaneous/Iterator.h +++ b/Redcraft.Utility/Source/Public/Miscellaneous/Iterator.h @@ -192,6 +192,40 @@ FORCEINLINE constexpr I Prev(I Iter, TMakeUnsigned N = 1) NAMESPACE_END(Iteration) +template > I> +FORCEINLINE void IndirectlyCopy(I&& Iter, J&& Jter) +{ + *Iter = *Jter; +} + +template > I> +FORCEINLINE void IndirectlyMove(I&& Iter, J&& Jter) +{ + *Iter = MoveTemp(*Jter); +} + +template requires (CSwappable, TIteratorReferenceType>) +FORCEINLINE void IndirectlySwap(I&& Iter, J&& Jter) +{ + Swap(*Iter, *Jter); +} + +template +concept CIndirectlyCopyable = requires(const I Iter, const J Jter) { IndirectlyCopy(Iter, Jter); }; + +template +concept CIndirectlyMovable = requires(const I Iter, const J Jter) { IndirectlyMove(Iter, Jter); }; + +template +concept CIndirectlySwappable = CIndirectlyReadable && CIndirectlyReadable + && requires(const I Iter, const J Jter) + { + IndirectlySwap(Iter, Iter); + IndirectlySwap(Jter, Jter); + IndirectlySwap(Iter, Jter); + IndirectlySwap(Jter, Iter); + }; + /** A iterator adaptor for reverse-order traversal. */ template class TReverseIterator final