29template <
class TargetT,
typename SourceT>
30[[nodiscard]]
constexpr auto rangeTo(SourceT&& sourceRange)
32#if defined(__cpp_lib_ranges_to_container)
33 return std::ranges::to<TargetT>(std::forward<SourceT>(sourceRange));
35 using std::begin, std::end;
36 return TargetT(begin(sourceRange), end(sourceRange));
41template <
template <
typename>
class TargetT,
typename SourceT>
42[[nodiscard]]
constexpr auto rangeTo(SourceT&& sourceRange)
45#if defined(__cpp_lib_ranges_to_container)
46 return std::ranges::to<TargetT<std::ranges::range_value_t<SourceT>>>(
47 std::forward<SourceT>(sourceRange));
49 using std::begin, std::end;
50 return TargetT<std::ranges::range_value_t<SourceT>>(begin(sourceRange), end(sourceRange));
54#ifdef __cpp_lib_ranges_contains
59 return std::ranges::find(c, v, std::move(proj)) != std::ranges::end(c);
constexpr auto rangeContains(const auto &c, const auto &v, auto proj)
constexpr auto rangeTo(SourceT &&sourceRange)
A replacement of std::ranges::to() while toolchains catch up.