SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
semialphabet_any.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
15{
16
43template <size_t size>
44class semialphabet_any : public alphabet_base<semialphabet_any<size>, size, void>
45{
46private:
49
51 friend base_t;
52
53public:
55 using base_t::to_rank;
56
60 constexpr semialphabet_any() noexcept = default;
61 constexpr semialphabet_any(semialphabet_any const &) noexcept = default;
62 constexpr semialphabet_any(semialphabet_any &&) noexcept = default;
63 constexpr semialphabet_any & operator=(semialphabet_any const &) noexcept = default;
64 constexpr semialphabet_any & operator=(semialphabet_any &&) noexcept = default;
65 ~semialphabet_any() noexcept = default;
66
71 template <typename other_alph_t>
72 requires (!std::same_as<other_alph_t, semialphabet_any>)
73 && semialphabet<other_alph_t> && (alphabet_size<other_alph_t> == size)
74 explicit semialphabet_any(other_alph_t const other)
75 {
77 }
79
84 template <typename other_alph_t>
85 requires (!std::same_as<other_alph_t, semialphabet_any>)
86 && semialphabet<other_alph_t> && (alphabet_size<other_alph_t> == size) && std::regular<other_alph_t>
87 explicit operator other_alph_t() const
88 {
89 other_alph_t other{};
90 assign_rank_to(to_rank(), other);
91 return other;
92 }
93};
94
95} // namespace seqan3
Provides seqan3::alphabet_base.
A CRTP-base that makes defining a custom alphabet easier.
Definition alphabet_base.hpp:54
constexpr rank_type to_rank() const noexcept
Return the letter's numeric value (rank in the alphabet).
Definition alphabet_base.hpp:134
static constexpr detail::min_viable_uint_t< size > alphabet_size
The size of the alphabet, i.e. the number of different values it can take.
Definition alphabet_base.hpp:196
constexpr semialphabet_any< size > & assign_rank(rank_type const c) noexcept
Assign from a numeric value.
Definition alphabet_base.hpp:184
A semi-alphabet that type erases all other semi-alphabets of the same size.
Definition semialphabet_any.hpp:45
constexpr semialphabet_any() noexcept=default
Defaulted.
constexpr auto assign_rank_to
Assign a rank to an alphabet object.
Definition alphabet/concept.hpp:290
constexpr auto to_rank
Return the rank representation of a (semi-)alphabet object.
Definition alphabet/concept.hpp:152
The basis for seqan3::alphabet, but requires only rank interface (not char).
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
SeqAn specific customisations in the standard namespace.
Hide me