SeqAn3  3.2.0
The Modern C++ library for sequence analysis.
alphabet/nucleotide/concept.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2022, Knut Reinert & MPI für molekulare Genetik
4 // This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5 // shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6 // -----------------------------------------------------------------------------------------------------
7 
14 #pragma once
15 
16 #include <concepts>
17 
19 
20 // ============================================================================
21 // complement()
22 // ============================================================================
23 
24 namespace seqan3::detail::adl_only
25 {
26 
28 template <typename... args_t>
29 void complement(args_t...) = delete;
30 
33 struct complement_cpo : public detail::customisation_point_object<complement_cpo, 2>
34 {
36  using base_t = detail::customisation_point_object<complement_cpo, 2>;
38  using base_t::base_t;
39 
44  template <typename alphabet_t>
45  static constexpr auto SEQAN3_CPO_OVERLOAD(priority_tag<2>, alphabet_t && alphabet)(
46  /*return*/ seqan3::custom::alphabet<alphabet_t>::complement(std::forward<alphabet_t>(alphabet)) /*;*/
47  );
48 
53  template <typename alphabet_t>
54  static constexpr auto SEQAN3_CPO_OVERLOAD(priority_tag<1>, alphabet_t && alphabet)(
55  /*return*/ complement(std::forward<alphabet_t>(alphabet)) /*;*/
56  );
57 
62  template <typename alphabet_t>
63  static constexpr auto SEQAN3_CPO_OVERLOAD(priority_tag<0>, alphabet_t && alphabet)(
64  /*return*/ std::forward<alphabet_t>(alphabet).complement() /*;*/
65  );
66 };
67 
68 } // namespace seqan3::detail::adl_only
69 
70 namespace seqan3
71 {
72 
111 inline constexpr auto complement = detail::adl_only::complement_cpo{};
113 
114 // ============================================================================
115 // nucleotide_alphabet concept
116 // ============================================================================
117 
146 template <typename t>
147 concept nucleotide_alphabet = alphabet<t> && requires (t val) {
148  {
149  seqan3::complement(val)
150  };
151  };
153 
154 } // namespace seqan3
Core alphabet concept and free function/type trait wrappers.
The <concepts> header from C++20's standard library.
#define SEQAN3_CPO_OVERLOAD(...)
A macro that helps to define a seqan3::detail::customisation_point_object.
Definition: customisation_point.hpp:107
constexpr auto complement
Return the complement of a nucleotide object.
Definition: alphabet/nucleotide/concept.hpp:105
requires requires
The rank_type of the semi-alphabet; defined as the return type of seqan3::to_rank....
Definition: alphabet/concept.hpp:164
The generic alphabet concept that covers most data types used in ranges.
A concept that indicates whether an alphabet represents nucleotides.
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
A type that can be specialised to provide customisation point implementations so that third party typ...
Definition: alphabet/concept.hpp:49