Template for range adaptor closure objects that store arguments and wrap a proto-adaptor. More...
#include <seqan3/range/views/detail.hpp>
Public Member Functions | |
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. | |
constexpr auto | operator() (urng_t &&urange) const & |
Function-style overload for ranges. | |
Constructors, destructor and assignment | |
constexpr | adaptor_from_functor ()=default |
Defaulted. | |
constexpr | adaptor_from_functor (adaptor_from_functor const &) noexcept=default |
Defaulted. | |
constexpr | adaptor_from_functor (adaptor_from_functor &&) noexcept=default |
Defaulted. | |
constexpr adaptor_from_functor & | operator= (adaptor_from_functor const &) noexcept=default |
Defaulted. | |
constexpr adaptor_from_functor & | operator= (adaptor_from_functor &&) noexcept=default |
Defaulted. | |
~adaptor_from_functor () noexcept=default | |
Defaulted. | |
constexpr | adaptor_from_functor (functor_type f, stored_args_ts ... args) |
Construct from functor and possibly arguments. | |
Private Types | |
using | base_type = adaptor_base< adaptor_from_functor< functor_type, stored_args_ts... >, stored_args_ts... > |
Type of the CRTP-base. | |
Private Member Functions | |
template<std::ranges::input_range urng_t> | |
constexpr auto | impl (urng_t &&urange, stored_args_ts ... args) const |
Delegate the range argument and stored arguments to the wrapped functor. More... | |
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. | |
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 | base_type |
Befriend the base class so it can call impl(). | |
friend | derived_type |
Befriend the derived_type so it can access private members if need be. | |
functor_type | fun |
The stored functor, usually a "proto-adaptor". | |
Template for range adaptor closure objects that store arguments and wrap a proto-adaptor.
functor_type | Type of the proto-adaptor functor. |
stored_args_ts | Types of the stored arguments. |
This template is particularly useful in combination with range adaptor objects that are not closure objects (a.k.a. proto adaptors). These objects take other parameters in addition to the range parameter that they might need to store in which case they can return an object of this type with the stored arguments.
This template delegates back to the proto adaptor for handling range input (impl() calls operator() of the proto-adaptor).
From include/seqan3/range/views/kmer_hash.hpp:
This is the full proto-adaptor, first look at the second member function: it handles range and argument input and delegates to the view's constructor. In other, simpler cases you could invoke other adaptors here.
And it provides an operator()
that takes only the argument and returns a range adaptor closure object with the argument wrapped (first member function). The proto-adaptor is passed to the closure object, as well, so that the proto-adaptor's operator()
can be used for handling range input.
Note that the proto-adaptor does not provide operator|
, this is only required of adaptor closure objects.
|
inlineconstexprprivate |
Delegate the range argument and stored arguments to the wrapped functor.
urng_t | The underlying range type. |
stored_args_ts | The arguments to the view (this first one will be a range, the rest is optional). |
[in] | urange | The underling range. |
[in] | args | The arguments to the constructor. |