SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
|
A CRTP base-class that defines a customisation_point_object (CPO). More...
#include <seqan3/core/detail/customisation_point.hpp>
Public Member Functions | |
template<typename... args_t, typename derived_type = derived_t> | |
constexpr auto | operator() (args_t &&... args) const noexcept(auto) |
SFINAE-friendly call-operator of this seqan3::detail::customisation_point_object instance. | |
Private Member Functions | |
constexpr | customisation_point_object ()=default |
Defaulted. | |
constexpr | customisation_point_object (customisation_point_object &&)=default |
Defaulted. | |
constexpr | customisation_point_object (customisation_point_object const &)=default |
Defaulted. | |
constexpr customisation_point_object & | operator= (customisation_point_object &&)=default |
Defaulted. | |
constexpr customisation_point_object & | operator= (customisation_point_object const &)=default |
Defaulted. | |
Private Attributes | |
friend | derived_t |
Allow derived_t to inherit the constructors of this CRTP-class. | |
A CRTP base-class that defines a customisation_point_object (CPO).
derived_t | CRTP derived type. |
max_priority | The (highest) start priority the CPO overloads will be checked from. |
You can define a CPO similar to decltype(std::ranges::begin)
that accepts range.begin()
(Member) or begin(range)
(ADL):
and instantiate it like std::ranges::begin:
Any type that has a member function with the name "begin" will now work (a real definition of std::ranges::begin would, of course, further constraint the overload):
Furthermore, any unqualified function call "begin":
seqan3::detail::customisation_point_object is designed to be SFINAE friendly:
|
inlineconstexprnoexcept |
SFINAE-friendly call-operator of this seqan3::detail::customisation_point_object instance.
This operator implements the actual CPO overload resolution. Overload resolution will try each base class of seqan3::detail::priority_tag<max_priority>, seqan3::detail::priority_tag<max_priority - 1>, ..., seqan3::detail::priority_tag<0> as first argument to derived_t::cpo_overload
. That means a high priority in seqan3::detail::priority_tag will be evaluated first and one can define an order which overload should be prioritised if multiple overloads match.
It perfectly forwards the result and noexcept-property of the derived_t::cpo_overload
.