SeqAn3 3.4.0-rc.4
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-2025 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2025 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>
26struct priority_tag
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>
139struct customisation_point_object
140{
141private:
143 friend derived_t;
144
145 constexpr customisation_point_object() = default;
146 constexpr customisation_point_object(customisation_point_object &&) = default;
147 constexpr customisation_point_object(customisation_point_object const &) = default;
148 constexpr customisation_point_object & operator=(customisation_point_object &&) = default;
149 constexpr customisation_point_object & operator=(customisation_point_object const &) = 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
Provides platform and dependency checks.
Hide me