51 template <
typename derived_type,
size_t size,
typename char_t =
char>
55 static_assert(
size != 0,
"Alphabet size must be >= 1");
97 requires !
std::Same<char_t,
void>
100 return derived_type::rank_to_char[rank];
147 rank = derived_type::char_to_rank[
static_cast<index_t
>(c)];
148 return static_cast<derived_type &
>(*this);
168 assert(static_cast<size_t>(c) < static_cast<size_t>(
alphabet_size));
170 return static_cast<derived_type &
>(*this);
179 friend constexpr
bool operator==(derived_type
const lhs, derived_type
const rhs) noexcept
185 friend constexpr
bool operator!=(derived_type
const lhs, derived_type
const rhs) noexcept
191 friend constexpr
bool operator<(derived_type
const lhs, derived_type
const rhs) noexcept
197 friend constexpr
bool operator>(derived_type
const lhs, derived_type
const rhs) noexcept
203 friend constexpr
bool operator<=(derived_type
const lhs, derived_type
const rhs) noexcept
209 friend constexpr
bool operator>=(derived_type
const lhs, derived_type
const rhs) noexcept
232 template <
typename derived_type,
typename char_t>
263 requires !
std::Same<char_t,
void>
266 return derived_type::char_value;
285 return static_cast<derived_type &
>(*this);
291 return static_cast<derived_type &
>(*this);
300 friend constexpr
bool operator==(derived_type
const, derived_type
const) noexcept
305 friend constexpr
bool operator!=(derived_type
const, derived_type
const) noexcept
310 friend constexpr
bool operator<(derived_type
const, derived_type
const) noexcept
315 friend constexpr
bool operator>(derived_type
const, derived_type
const) noexcept
320 friend constexpr
bool operator<=(derived_type
const, derived_type
const) noexcept
325 friend constexpr
bool operator>=(derived_type
const, derived_type
const) noexcept
332 #if SEQAN3_WORKAROUND_GCC_87113 333 bool _bug_workaround{};
detail::min_viable_uint_t< size - 1 > rank_type
The type of the alphabet when represented as a number (e.g. via to_rank()).
Definition: alphabet_base.hpp:63
constexpr derived_type & assign_rank(rank_type const) noexcept
Assign from a numeric value.
Definition: alphabet_base.hpp:289
Provides metaprogramming utilities for integer types.
constexpr auto to_rank
Return the rank representation of a (semi-)alphabet object.
Definition: concept.hpp:103
SeqAn specific customisations in the standard namespace.
::ranges::size size
Alias for ranges::size. Obtains the size of a range whose size can be calculated in constant time...
Definition: ranges:189
The main SeqAn3 namespace.
constexpr derived_type & assign_rank(rank_type const c) noexcept
Assign from a numeric value.
Definition: alphabet_base.hpp:166
constexpr alphabet_base() noexcept=default
Defaulted.
constexpr char_type to_char() const noexcept
Return the letter as a character of char_type.
Definition: alphabet_base.hpp:95
constexpr rank_type to_rank() const noexcept
Return the letter's numeric value (rank in the alphabet).
Definition: alphabet_base.hpp:270
static detail::min_viable_uint_t< size > constexpr alphabet_size
The size of the alphabet, i.e. the number of different values it can take.
Definition: alphabet_base.hpp:175
Provides C++20 additions to the type_traits header.
constexpr rank_type to_rank() const noexcept
Return the letter's numeric value (rank in the alphabet).
Definition: alphabet_base.hpp:117
Core alphabet concept and free function/type trait wrappers.
A CRTP-base that makes defining a custom alphabet easier.
Definition: alphabet_base.hpp:52
Static reflection for arbitrary types.
The concept std::Same<T, U> is satisfied if and only if T and U denote the same type.
constexpr derived_type & assign_char(char_type const c) noexcept
Assign from a character, implicitly converts invalid characters.
Definition: alphabet_base.hpp:141
std::conditional_t< std::Same< char_t, void >, char, char_t > char_type
The char representation; conditional needed to make semi alphabet definitions legal.
Definition: alphabet_base.hpp:61
bool rank_type
The type of the alphabet when represented as a number (e.g. via to_rank()).
Definition: alphabet_base.hpp:242