feat(range): add range pipe operator support

This commit is contained in:
2024-12-16 15:09:57 +08:00
parent d88eb4be5e
commit d2b6e0c669
6 changed files with 139 additions and 7 deletions

View File

@ -2,6 +2,7 @@
#include "CoreTypes.h"
#include "Range/View.h"
#include "Range/Pipe.h"
#include "Range/Utility.h"
#include "Templates/Utility.h"
#include "TypeTraits/TypeTraits.h"
@ -148,6 +149,15 @@ NODISCARD FORCEINLINE constexpr auto All(R&& InRange)
else return TOwningView(Forward<R>(InRange));
}
/** Creates A view adapter that includes all elements of a range. */
NODISCARD FORCEINLINE constexpr auto All()
{
return TAdaptorClosure([]<CViewableRange R> requires (requires { All(DeclVal<R&&>()); }) (R && Base)
{
return All(Forward<R>(Base));
});
}
/** A view adapter that includes all elements of a range. */
template <CViewableRange R>
using TAllView = decltype(Range::All(DeclVal<R>()));