SeqAn3 3.4.0-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-2024 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
13
14namespace seqan3::detail
15{
16
17// ============================================================================
18// priority_tag
19// ============================================================================
20
23template <size_t I>
24struct priority_tag
26 // Doxygen fail
27 : priority_tag<I - 1>
29{};
30
32template <>
33struct priority_tag<0>
34{};
35
36} // namespace seqan3::detail
37
38// ============================================================================
39// SEQAN3_CPO_OVERLOAD
40// ============================================================================
41#if SEQAN3_DOXYGEN_ONLY(1) 0
59# define SEQAN3_CPO_OVERLOAD_BODY(...) \
60 noexcept(auto) \
61 { \
62 return __VA_ARGS__; \
63 }
64#else // ^^^ (simplified) doxygen version / normal definition vvv
65# define SEQAN3_CPO_OVERLOAD_BODY(...) \
66 noexcept(noexcept(__VA_ARGS__))->decltype(__VA_ARGS__) \
67 { \
68 return __VA_ARGS__; \
69 } \
70 static_assert(true)
71#endif
72
104#define SEQAN3_CPO_OVERLOAD(...) cpo_overload(__VA_ARGS__) SEQAN3_CPO_OVERLOAD_BODY
105
106namespace seqan3::detail
107{
136template <typename derived_t, unsigned max_priority>
137struct customisation_point_object
138{
139private:
141 friend derived_t;
142
143 constexpr customisation_point_object() = default;
144 constexpr customisation_point_object(customisation_point_object &&) = default;
145 constexpr customisation_point_object(customisation_point_object const &) = default;
146 constexpr customisation_point_object & operator=(customisation_point_object &&) = default;
147 constexpr customisation_point_object & operator=(customisation_point_object const &) = default;
148
149public:
160 template <typename... args_t, typename derived_type = derived_t /*circumvent incomplete types*/>
161 constexpr auto operator()(args_t &&... args) const SEQAN3_CPO_OVERLOAD_BODY(
162 /*return*/ derived_type::cpo_overload(priority_tag<max_priority>{}, std::forward<args_t>(args)...) /*;*/
163 );
164};
165} // namespace seqan3::detail
#define SEQAN3_CPO_OVERLOAD_BODY(...)
A macro helper for SEQAN3_CPO_OVERLOAD.
Definition customisation_point.hpp:59
Provides platform and dependency checks.
Hide me