Loading...
Searching...
No Matches
customisation_point.hpp
Go to the documentation of this file.
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause
#pragma once
#include <utility>
#include <seqan3/core/platform.hpp>
namespace seqan3::detail
{
// ============================================================================
// priority_tag
// ============================================================================
template <size_t I>
struct priority_tag
// Doxygen fail
: priority_tag<I - 1>
{};
template <>
struct priority_tag<0>
{};
} // namespace seqan3::detail
// ============================================================================
// SEQAN3_CPO_OVERLOAD
// ============================================================================
#if SEQAN3_DOXYGEN_ONLY(1) 0
# define SEQAN3_CPO_OVERLOAD_BODY(...) \
noexcept(auto) \
{ \
return __VA_ARGS__; \
}
#else // ^^^ (simplified) doxygen version / normal definition vvv
# define SEQAN3_CPO_OVERLOAD_BODY(...) \
noexcept(noexcept(__VA_ARGS__))->decltype(__VA_ARGS__) \
{ \
return __VA_ARGS__; \
} \
static_assert(true)
#endif
#define SEQAN3_CPO_OVERLOAD(...) cpo_overload(__VA_ARGS__) SEQAN3_CPO_OVERLOAD_BODY
namespace seqan3::detail
{
template <typename derived_t, unsigned max_priority>
struct customisation_point_object
{
private:
friend derived_t;
constexpr customisation_point_object() = default;
constexpr customisation_point_object(customisation_point_object &&) = default;
constexpr customisation_point_object(customisation_point_object const &) = default;
constexpr customisation_point_object & operator=(customisation_point_object &&) = default;
constexpr customisation_point_object & operator=(customisation_point_object const &) = default;
public:
template <typename... args_t, typename derived_type = derived_t /*circumvent incomplete types*/>
constexpr auto operator()(args_t &&... args) const SEQAN3_CPO_OVERLOAD_BODY(
/*return*/ derived_type::cpo_overload(priority_tag<max_priority>{}, std::forward<args_t>(args)...) /*;*/
);
};
} // namespace seqan3::detail
SEQAN3_CPO_OVERLOAD_BODY
#define SEQAN3_CPO_OVERLOAD_BODY(...)
A macro helper for SEQAN3_CPO_OVERLOAD.
Definition customisation_point.hpp:61
std::forward
T forward(T... args)
platform.hpp
Provides platform and dependency checks.
utility
Hide me