23namespace bio::ranges::detail
30template <
typename left_adaptor_t,
typename right_adaptor_t>
31class combined_adaptor;
78template <
typename derived_type,
typename... stored_args_ts>
86 template <
typename urng_t,
size_t... Is>
91 return static_cast<derived_type
const &
>(*this).impl(
92 std::forward<urng_t>(urange),
97 template <
typename urng_t,
size_t... Is>
101 return static_cast<derived_type &&
>(*this).impl(
102 std::forward<urng_t>(urange),
114 constexpr adaptor_base(adaptor_base
const &)
noexcept =
default;
115 constexpr adaptor_base(adaptor_base &&) noexcept = default;
116 constexpr adaptor_base & operator=(adaptor_base const &) noexcept = default;
117 constexpr adaptor_base & operator=(adaptor_base &&) noexcept = default;
118 ~adaptor_base() noexcept = default;
121 constexpr adaptor_base(stored_args_ts... args) noexcept(
122 noexcept(
std::tuple<stored_args_ts...>{std::forward<stored_args_ts>(args)...})) :
123 arguments{
std::
forward<stored_args_ts>(args)...}
128 template <std::ranges::input_range urng_t>
129 constexpr auto operator()(urng_t && urange)
const &
135 template <std::ranges::input_range urng_t>
136 constexpr auto operator()(urng_t && urange) &&
138 return std::move(*this).pass_args_to_impl(std::forward<urng_t>(urange),
153 template <
typename arg_t>
154 constexpr friend auto operator|(arg_t && arg, derived_type
const & me)
156 if constexpr (std::ranges::input_range<arg_t>)
157 return me(std::forward<arg_t>(arg));
159 return combined_adaptor{std::forward<arg_t>(arg), me};
163 template <
typename arg_t>
164 constexpr friend auto operator|(arg_t && arg, derived_type && me)
166 if constexpr (std::ranges::input_range<arg_t>)
167 return std::move(me)(std::forward<arg_t>(arg));
169 return combined_adaptor{std::forward<arg_t>(arg), std::move(me)};
188 template <
typename arg_t>
189 constexpr friend auto operator|(adaptor_base
const & me, arg_t && arg)
191 return combined_adaptor{
static_cast<derived_type
const &
>(me), std::forward<arg_t>(arg)};
195 template <
typename arg_t>
196 constexpr friend auto operator|(adaptor_base && me, arg_t && arg)
198 return combined_adaptor{
static_cast<derived_type &&
>(me), std::forward<arg_t>(arg)};
216template <
typename left_adaptor_t,
typename right_adaptor_t>
217class combined_adaptor :
218 public adaptor_base<combined_adaptor<left_adaptor_t, right_adaptor_t>, left_adaptor_t, right_adaptor_t>
222 using base_type = adaptor_base<combined_adaptor<left_adaptor_t, right_adaptor_t>, left_adaptor_t, right_adaptor_t>;
228 template <std::ranges::input_range urng_t,
typename left_adaptor_t_,
typename right_adaptor_t_>
229 static auto impl(urng_t && urange, left_adaptor_t_ && left_adaptor, right_adaptor_t_ && right_adaptor)
231 return std::forward<urng_t>(urange) | std::forward<left_adaptor_t_>(left_adaptor) |
232 std::forward<right_adaptor_t_>(right_adaptor);
239 constexpr combined_adaptor() =
default;
240 constexpr combined_adaptor(combined_adaptor
const &)
noexcept =
default;
241 constexpr combined_adaptor(combined_adaptor &&) noexcept = default;
242 constexpr combined_adaptor & operator=(combined_adaptor const &) noexcept = default;
243 constexpr combined_adaptor & operator=(combined_adaptor &&) noexcept = default;
244 ~combined_adaptor() noexcept = default;
247 using base_type::base_type;
250 constexpr combined_adaptor(left_adaptor_t l, right_adaptor_t r) :
251 base_type{std::forward<left_adaptor_t>(l), std::forward<right_adaptor_t>(r)}
283template <
template <
typename,
typename...>
typename view_type>
284class adaptor_for_view_without_args :
public adaptor_base<adaptor_for_view_without_args<view_type>>
288 using base_type = adaptor_base<adaptor_for_view_without_args<view_type>>;
299 template <
typename... arg_types>
300 static auto impl(arg_types &&... args)
302 return view_type{std::forward<arg_types>(args)...};
310 constexpr adaptor_for_view_without_args() =
default;
312 constexpr adaptor_for_view_without_args(adaptor_for_view_without_args
const &)
noexcept =
default;
314 constexpr adaptor_for_view_without_args(adaptor_for_view_without_args &&) noexcept = default;
316 constexpr adaptor_for_view_without_args & operator=(adaptor_for_view_without_args const &) noexcept = default;
318 constexpr adaptor_for_view_without_args & operator=(adaptor_for_view_without_args &&) noexcept = default;
320 ~adaptor_for_view_without_args() noexcept = default;
323 using base_type::base_type;
362template <typename functor_type, typename... stored_args_ts>
363class adaptor_from_functor :
364 public adaptor_base<adaptor_from_functor<functor_type, stored_args_ts...>, stored_args_ts...>
368 using base_type = adaptor_base<adaptor_from_functor<functor_type, stored_args_ts...>, stored_args_ts...>;
383 template <std::ranges::input_range urng_t>
384 constexpr auto impl(urng_t && urange, stored_args_ts... args)
const
386 return fun(std::forward<urng_t>(urange), std::forward<stored_args_ts>(args)...);
393 constexpr adaptor_from_functor() =
default;
394 constexpr adaptor_from_functor(adaptor_from_functor
const &)
noexcept =
default;
395 constexpr adaptor_from_functor(adaptor_from_functor &&) noexcept = default;
396 constexpr adaptor_from_functor & operator=(adaptor_from_functor const &) noexcept = default;
397 constexpr adaptor_from_functor & operator=(adaptor_from_functor &&) noexcept = default;
398 ~adaptor_from_functor() noexcept = default;
401 constexpr adaptor_from_functor(functor_type f, stored_args_ts... args) :
402 base_type{std::forward<stored_args_ts>(args)...}, fun{std::move(f)}
Provides various type traits on generic types.
constexpr translation_frames operator|(translation_frames lhs, translation_frames rhs) noexcept
Binary operators for bio::alphabet::translation_frames.
Definition: translation.hpp:111
Provides various transformation traits used by the range module.