SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
alphabet/aminoacid/concept.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
11#pragma once
12
13#include <type_traits>
14
17
18// ============================================================================
19// aminoacid_empty_base
20// ============================================================================
21
22namespace seqan3
23{
24
33
34} // namespace seqan3
35
36// ============================================================================
37// enable_aminoacid
38// ============================================================================
39
40namespace seqan3::detail::adl_only
41{
42
44template <typename... args_t>
45void enable_aminoacid(args_t...) = delete;
46
49template <typename alphabet_t>
50struct enable_aminoacid_cpo : public detail::customisation_point_object<enable_aminoacid_cpo<alphabet_t>, 2>
51{
53 using base_t = detail::customisation_point_object<enable_aminoacid_cpo<alphabet_t>, 2>;
55 using base_t::base_t;
56
60 template <typename alphabet_type>
61 using alphabet_or_type_identity =
63 && seqan3::is_constexpr_default_constructible_v<std::remove_cvref_t<alphabet_type>>,
66
70 template <typename alphabet_type = alphabet_t>
71 static constexpr auto SEQAN3_CPO_OVERLOAD(priority_tag<2>)(
73 );
74
84 template <typename alphabet_type = alphabet_t>
85 static constexpr auto SEQAN3_CPO_OVERLOAD(priority_tag<1>)(
86 /*return*/ std::bool_constant<enable_aminoacid(alphabet_or_type_identity<alphabet_type>{})>::value == true /*;*/
87 );
88
92 template <typename alphabet_type = alphabet_t>
93 static constexpr auto SEQAN3_CPO_OVERLOAD(priority_tag<0>)(
94 /*return*/ std::is_base_of_v<seqan3::aminoacid_empty_base, alphabet_type> == true /*;*/
95 );
96};
97
98} // namespace seqan3::detail::adl_only
99
100namespace seqan3
101{
102
148template <typename t>
149inline constexpr bool enable_aminoacid =
150 detail::adl_only::enable_aminoacid_cpo<std::remove_cvref_t<t>>::cpo_overload(detail::priority_tag<2>{});
151
152// ============================================================================
153// concept
154// ============================================================================
155
172template <typename type>
173concept aminoacid_alphabet = alphabet<type> && enable_aminoacid<type>;
175
176} // namespace seqan3
Core alphabet concept and free function/type trait wrappers.
#define SEQAN3_CPO_OVERLOAD(...)
A macro that helps to define a seqan3::detail::customisation_point_object.
Definition customisation_point.hpp:104
constexpr bool enable_aminoacid
A trait that indicates whether a type shall model seqan3::aminoacid_alphabet.
Definition alphabet/aminoacid/concept.hpp:143
The generic alphabet concept that covers most data types used in ranges.
A concept that indicates whether an alphabet represents amino acids.
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
This is an empty base class that can be inherited by types that shall model seqan3::aminoacid_alphabe...
Definition alphabet/aminoacid/concept.hpp:32
Provides type traits for working with templates.
Hide me