25namespace bio::ranges::detail
34class type_reduce_fn :
public adaptor_base<type_reduce_fn>
38 using base_t = adaptor_base<type_reduce_fn>;
51 template <std::ranges::range urng_t>
52 static constexpr auto impl(urng_t && urange)
54 static_assert(std::ranges::viewable_range<urng_t>,
55 "The views::type_reduce adaptor can only be passed viewable_ranges, i.e. Views or "
59 if constexpr (std::ranges::borrowed_range<urng_t> && std::ranges::contiguous_range<urng_t> &&
60 std::ranges::sized_range<urng_t> &&
61 std::same_as<std::ranges::range_reference_t<urng_t>,
char const &>)
66 else if constexpr (std::ranges::borrowed_range<urng_t> && std::ranges::contiguous_range<urng_t> &&
67 std::ranges::sized_range<urng_t>)
69 return std::span{std::ranges::data(urange), std::ranges::size(urange)};
72 else if constexpr (std::ranges::borrowed_range<urng_t> && std::ranges::random_access_range<urng_t> &&
73 std::ranges::sized_range<urng_t>)
75 return std::ranges::subrange<std::ranges::iterator_t<urng_t>, std::ranges::iterator_t<urng_t>>{
78 std::ranges::size(urange)};
83 return std::views::all(std::forward<urng_t>(urange));
constexpr auto type_reduce
A view adaptor that behaves like std::views::all, but type erases certain ranges.
Definition: type_reduce.hpp:152
The BioC++ namespace for views.
The ranges module's namespace.
decltype(views::type_reduce(std::declval< t >())) type_reduce_view
Deduces the return value of bio::views::type_reduce.
Definition: type_reduce.hpp:162
Additional non-standard concepts for ranges.
Auxiliary header for the views submodule .
Provides various traits to inspect templates.