21namespace bio::ranges::detail
26template <
typename container_t>
35 auto impl(std::ranges::range
auto && rng, container_t & container)
const
45 auto impl(std::ranges::range
auto && rng, container_t & container)
const
46 requires std::ranges::range<
std::decay_t<
decltype(*rng.begin())>>
48 auto adapter = to_fn<typename container_t::value_type>{};
49 auto inner_rng = rng | std::views::transform(adapter);
60 template <std::ranges::range rng_t,
typename... args_t>
61 constexpr auto operator()(rng_t && rng, args_t &&... args)
const
63 auto r = container_t(std::forward<args_t>(args)...);
66 if constexpr (std::ranges::sized_range<rng_t> &&
requires(container_t c) { c.reserve(
std::size_t{}); })
68 r.reserve(std::ranges::size(rng));
71 impl(std::forward<rng_t>(rng), r);
80template <
template <
typename...>
typename container_t>
81struct to_template_template_fn
89 template <std::ranges::range rng_t,
typename... args_t>
90 constexpr auto operator()(rng_t && rng, args_t &&... args)
const
93 auto adapter = to_fn<container_t<value_t>>{};
94 return adapter(std::forward<rng_t>(rng), std::forward<args_t>(args)...);
113template <
typename container_t,
typename... args_t>
114constexpr auto to(args_t &&... args)
116 return detail::adaptor_from_functor{detail::to_fn<container_t>{}, std::forward<args_t>(args)...};
120template <
template <
typename...>
typename container_t,
typename... args_t>
121constexpr auto to(args_t &&... args)
123 return detail::adaptor_from_functor{detail::to_template_template_fn<container_t>{}, std::forward<args_t>(args)...};
127template <
typename container_t, std::ranges::range rng_t,
typename... args_t>
128constexpr auto to(rng_t && rng, args_t &&... args)
130 return detail::adaptor_from_functor{detail::to_fn<container_t>{},
131 std::forward<args_t>(args)...}(std::forward<rng_t>(rng));
135template <
template <
typename...>
typename container_t, std::ranges::range rng_t,
typename... args_t>
136constexpr auto to(rng_t && rng, args_t &&... args)
138 return detail::adaptor_from_functor{detail::to_template_template_fn<container_t>{},
139 std::forward<args_t>(args)...}(std::forward<rng_t>(rng));
T back_inserter(T... args)
constexpr auto to(args_t &&... args)
Converts a range to a container.
Definition: to.hpp:114
The ranges module's namespace.
Auxiliary header for the views submodule .