diff --git a/source/mijin/util/iterators.hpp b/source/mijin/util/iterators.hpp index 5fca076..3a33743 100644 --- a/source/mijin/util/iterators.hpp +++ b/source/mijin/util/iterators.hpp @@ -43,7 +43,7 @@ template struct is_range_adapter_type> : std::true_type {}; template -concept RangeAdapterType = is_range_adapter_type::value; +concept RangeAdapterType = is_range_adapter_type>::value; static_assert(!is_range_adapter_type>::value); static_assert(is_range_adapter_type::value); @@ -51,7 +51,7 @@ static_assert(is_range_adapter_type::value); template struct RangeRef { - T range; + std::remove_reference_t range; decltype(auto) begin() const { @@ -399,6 +399,26 @@ auto operator|(TIterable&& iterable, Collect) { return collect(std::forward(iterable)); } + +struct Chain {}; + +template +struct Chain2 +{ + RangeRef range; +}; + +template +auto operator|(TIterable&& iterable, Chain) +{ + return Chain2{.range = {.range = std::forward(iterable)}}; +} + +template +auto operator|(Chain2 chain2, TSecondIterable&& secondIterable) +{ + return chain(chain2.range.range, std::forward(secondIterable)); +} } } // namespace mijin