SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
|
CRTP-base to simplify the definition of range adaptor closure objects and similar types. More...
#include <seqan3/core/range/detail/adaptor_base.hpp>
Public Member Functions | |
template<std::ranges::input_range urng_t> | |
constexpr auto | operator() (urng_t &&urange) && |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
template<std::ranges::input_range urng_t> | |
constexpr auto | operator() (urng_t &&urange) const & |
Function-style overload for ranges. | |
Constructors, destructor and assignment | |
constexpr | adaptor_base (adaptor_base const &) noexcept=default |
Defaulted. | |
constexpr | adaptor_base (adaptor_base &&) noexcept=default |
Defaulted. | |
constexpr adaptor_base & | operator= (adaptor_base const &) noexcept=default |
Defaulted. | |
constexpr adaptor_base & | operator= (adaptor_base &&) noexcept=default |
Defaulted. | |
~adaptor_base () noexcept=default | |
Defaulted. | |
constexpr | adaptor_base (stored_args_ts... args) noexcept(noexcept(std::tuple< stored_args_ts... >{ std::forward< stored_args_ts >(args)...})) |
Constructor with possible arguments; becomes a default constructor for adaptors without args. | |
Private Member Functions | |
template<typename urng_t , size_t... Is> | |
constexpr auto | pass_args_to_impl (urng_t &&urange, std::index_sequence< Is... > const &) && |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
template<typename urng_t , size_t... Is> | |
constexpr auto | pass_args_to_impl (urng_t &&urange, std::index_sequence< Is... > const &) const & |
Helper function to unpack the tuple and delegate to the derived type. | |
Private Attributes | |
std::tuple< stored_args_ts... > | arguments |
Stores the arguments. | |
friend | derived_type |
Befriend the derived_type so it can access private members if need be. | |
Friends | |
template<typename arg_t > | |
constexpr friend auto | operator| (adaptor_base &&me, arg_t &&arg) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
template<typename arg_t > | |
constexpr friend auto | operator| (adaptor_base const &me, arg_t &&arg) |
Right-hand-side pipe operator that handles composing. | |
template<typename arg_t > | |
constexpr friend auto | operator| (arg_t &&arg, derived_type &&me) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
template<typename arg_t > | |
constexpr friend auto | operator| (arg_t &&arg, derived_type const &me) |
Left-hand-side pipe operator that handles range input or composing. | |
CRTP-base to simplify the definition of range adaptor closure objects and similar types.
derived_type | CRTP specialisation parameter. |
stored_args_ts | Some closure objects store values, these are their types. |
See How to write a view for details on what range adaptor closure objects are.
This class requires from the derived_type
:
impl()
function that takes a range and possibly further arguments.This base class provides:
operator()
that takes a range and passes the range and stored args to the derived_type.operator|
that also takes a range and passes the range and stored args to the derived_type.operator|
that takes another adaptor and returns seqan3::detail::combined_adaptorFrom include/seqan3/search/views/kmer_hash.hpp:
This adaptor directly derives from adaptor_base (instead of just using seqan3::detail::adaptor_for_view_without_args
) so that it can decide between actually calling the respective view's constructor and delegating to a different view (in this case std::views::all
) based on the type of input.
seqan3::detail::combined_adaptor
: Combine two adaptor closure objects into a new one.seqan3::detail::adaptor_for_view_without_args
: Create an adaptor closure object for a view that doesn't require args.seqan3::detail::adaptor_from_functor
: Create an adaptor closure object with possibly stored arguments that delegates to a functor, usually a stored proto-adaptor (for view classes that require arguments or adaptors that just forward to other adaptors).seqan3::views::deep
: Wraps an adaptor closure object or proto adaptor object and modifies the behaviour.
|
friend |
Right-hand-side pipe operator that handles composing.
arg_t | RHS argument type. |
[in] | me | LHS, another adaptor. |
[in] | arg | RHS. |
This operator assumes that the RHS is another range adaptor closure object and it returns a seqan3::detail::combined_adaptor that wraps that adaptor and this one.
Note that this operator takes adaptor_base and not derived_type as parameter type so that an implicit conversion is required for invoking this function. This prioritises the LHS-pipe-operator overload and resolves ambiguity in cases where they are competing. It has no semantic meaning, the type is down-cast inside the function again.
|
friend |
Left-hand-side pipe operator that handles range input or composing.
arg_t | LHS argument type. |
[in] | arg | LHS, either a range or another adaptor. |
[in] | me | RHS. |
If the LHS models std::ranges::input_range this functions delegates to operator() otherwise it assumes the LHS is another range adaptor closure object and it returns a seqan3::detail::combined_adaptor that wraps that adaptor and this one.