SeqAn3 3.1.0
The Modern C++ library for sequence analysis.
concept.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2021, 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
17#include <seqan3/std/concepts>
18
19// ============================================================================
20// complement()
21// ============================================================================
22
23namespace seqan3::detail::adl_only
24{
25
27template <typename ...args_t>
28void complement(args_t ...) = delete;
29
32struct complement_cpo : public detail::customisation_point_object<complement_cpo, 2>
33{
35 using base_t = detail::customisation_point_object<complement_cpo, 2>;
37 using base_t::base_t;
38
43 template <typename alphabet_t>
44 static constexpr auto SEQAN3_CPO_OVERLOAD(priority_tag<2>, alphabet_t && alphabet)
45 (
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 (
56 /*return*/ complement(std::forward<alphabet_t>(alphabet)) /*;*/
57 );
58
63 template <typename alphabet_t>
64 static constexpr auto SEQAN3_CPO_OVERLOAD(priority_tag<0>, alphabet_t && alphabet)
65 (
66 /*return*/ std::forward<alphabet_t>(alphabet).complement() /*;*/
67 );
68};
69
70} // namespace seqan3::detail::adl_only
71
72namespace seqan3
73{
74
113inline constexpr auto complement = detail::adl_only::complement_cpo{};
115
116// ============================================================================
117// nucleotide_alphabet concept
118// ============================================================================
119
148template <typename t>
149SEQAN3_CONCEPT nucleotide_alphabet = alphabet<t> && requires (t val)
150{
151 { seqan3::complement(val) };
152};
154
155} // 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:102
constexpr auto complement
Return the complement of a nucleotide object.
Definition: concept.hpp:104
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: cigar_operation_table.hpp:2
A type that can be specialised to provide customisation point implementations so that third party typ...
Definition: concept.hpp:49