14#include "CoreMinimal.h"
18#include "range/v3/all.hpp"
30 template <CRangeMember... Ranges>
31 auto Zip(Ranges&&...right)
33 return ranges::make_pipeable([&](
auto&& left)
31 auto Zip(Ranges&&...right) {
…}
40 template <CRangeMember... Ranges>
43 return ranges::make_pipeable([&](
auto&& left)
50 template <CRangeMember Input>
59 return ranges::make_pipeable([](
auto&& left){
return IsEmpty(left); });
67 decltype(
auto)
First(Input&& range, Value&& def)
69 return IsEmpty(range) ? def : *range.begin();
67 decltype(
auto)
First(Input&& range, Value&& def) {
…}
73 FORCEINLINE
auto First(
auto&& def)
75 return ranges::make_pipeable([&](
auto&& left){
return First(left, def); });
73 FORCEINLINE
auto First(
auto&& def) {
…}
88 return IsEmpty(range) ? Value{} : *range.begin();
97 return ranges::make_pipeable([&](
auto&& left){
return FirstOrDefault(left); });
112 template <CRangeMember Left, CRangeMember Right>
114 bool MatchOrdered(Left&& left, Right&& right,
bool matchOnlyBeginning =
false)
119 if (!matchOnlyBeginning &&
size(left) !=
size(right))
122 auto leftIt = left.begin();
123 auto rightIt = right.begin();
127 return matchOnlyBeginning || (
131 if (*leftIt != *rightIt)
return false;
114 bool MatchOrdered(Left&& left, Right&& right,
bool matchOnlyBeginning =
false) {
…}
137 template <CRangeMember Left,
typename Value>
138 requires CConvertibleToDecayed<Value, TRangeElementType<Left>>
139 bool MatchOrdered(Left&& left, std::initializer_list<Value>&& right,
bool matchOnlyBeginning =
false)
139 bool MatchOrdered(Left&& left, std::initializer_list<Value>&& right,
bool matchOnlyBeginning =
false) {
…}
155 template <CRangeMember Right>
158 return ranges::make_pipeable([&](
auto&& left){
return MatchOrdered(left, right, matchOnlyBeginning); });
161 template <
typename Value>
162 auto MatchOrdered(std::initializer_list<Value>&& right,
bool matchOnlyBeginning =
false)
164 return ranges::make_pipeable([&](
auto&& left){
return MatchOrdered(left, right, matchOnlyBeginning); });
162 auto MatchOrdered(std::initializer_list<Value>&& right,
bool matchOnlyBeginning =
false) {
…}
167 template <CFunctionLike Predicate>
170 return ranges::make_pipeable([&](
auto&& left){
return ranges::all_of(left, pred); });
173 template <CFunctionLike Predicate>
176 return ranges::make_pipeable([&](
auto&& left){
return ranges::any_of(left, pred); });
181 return ranges::views::filter([]<CValidable T>(T&& item)
Use this header and Start.h in tandem to include third-party library headers which may not tolerate U...
size_t size(TArray< T, A > const &r)
Use this header and End.h in tandem to include third-party library headers which may not tolerate Unr...
bool TestValid(T &&input)
Attempt to test the input object validity through various methods.
decltype(auto) First(Input &&range, Value &&def)
Get's the first element of a range or return a provided default value. Same as *r....
auto Concat(Ranges &&...right)
pipeable version of ranges::views::concat
bool MatchOrdered(Left &&left, Right &&right, bool matchOnlyBeginning=false)
Return true if input ranges match their values and their order.
FORCEINLINE auto IsEmpty()
Check if range is empty.
auto AnyOf(Predicate &&pred)
bool IteratorEquals(L const &l, R const &r)
FORCEINLINE auto FilterValid()
auto Zip(Ranges &&...right)
pipeable version of ranges::views::zip
TIteratorElementType< decltype(DeclVal< T >().begin())> TRangeElementType
return a range's associated content type determined by dereferencing their iterator.
auto AllOf(Predicate &&pred)
FORCEINLINE auto FirstOrDefault()
Get's the first element of a range or return the default value for the element type....
decltype(auto) Literal(std::initializer_list< T > &&input)
Make an initializer list compatible with range API's.