SeqAn3 3.4.3-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
customisation_point.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2026 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2026 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
12#include <utility>
13
15
16namespace seqan3::detail
17{
18
19// ============================================================================
20// priority_tag
21// ============================================================================
22
25template <size_t I>
28 // Doxygen fail
29 : priority_tag<I - 1>
31{};
32
34template <>
35struct priority_tag<0>
36{};
37
38} // namespace seqan3::detail
39
40// ============================================================================
41// SEQAN3_CPO_OVERLOAD
42// ============================================================================
43#if SEQAN3_DOXYGEN_ONLY(1) 0
61# define SEQAN3_CPO_OVERLOAD_BODY(...) \
62 noexcept(auto) \
63 { \
64 return __VA_ARGS__; \
65 }
66#else // ^^^ (simplified) doxygen version / normal definition vvv
67# define SEQAN3_CPO_OVERLOAD_BODY(...) \
68 noexcept(noexcept(__VA_ARGS__))->decltype(__VA_ARGS__) \
69 { \
70 return __VA_ARGS__; \
71 } \
72 static_assert(true)
73#endif
74
106#define SEQAN3_CPO_OVERLOAD(...) cpo_overload(__VA_ARGS__) SEQAN3_CPO_OVERLOAD_BODY
107
108namespace seqan3::detail
109{
138template <typename derived_t, unsigned max_priority>
140{
141private:
143 friend derived_t;
144
145 constexpr customisation_point_object() = default;
150
151public:
162 template <typename... args_t, typename derived_type = derived_t /*circumvent incomplete types*/>
163 constexpr auto operator()(args_t &&... args) const SEQAN3_CPO_OVERLOAD_BODY(
164 /*return*/ derived_type::cpo_overload(priority_tag<max_priority>{}, std::forward<args_t>(args)...) /*;*/
165 );
166};
167} // namespace seqan3::detail
#define SEQAN3_CPO_OVERLOAD_BODY(...)
A macro helper for SEQAN3_CPO_OVERLOAD.
Definition customisation_point.hpp:61
The internal SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
Provides platform and dependency checks.
A CRTP base-class that defines a customisation_point_object (CPO).
Definition customisation_point.hpp:140
constexpr customisation_point_object & operator=(customisation_point_object &&)=default
Defaulted.
constexpr customisation_point_object(customisation_point_object const &)=default
Defaulted.
constexpr customisation_point_object(customisation_point_object &&)=default
Defaulted.
constexpr auto operator()(args_t &&... args) const noexcept(auto)
SFINAE-friendly call-operator of this seqan3::detail::customisation_point_object instance.
Definition customisation_point.hpp:163
constexpr customisation_point_object()=default
Defaulted.
friend derived_t
Allow derived_t to inherit the constructors of this CRTP-class.
Definition customisation_point.hpp:143
constexpr customisation_point_object & operator=(customisation_point_object const &)=default
Defaulted.
A tag that allows controlled overload resolution via implicit base conversion rules.
Definition customisation_point.hpp:31
Hide me