55template <
typename derived_type,
size_t size,
typename char_t =
char>
59 static_assert(
size != 0,
"alphabet size must be >= 1");
117 requires (!
std::same_as<char_t,
void>)
120 return derived_type::rank_to_char(
rank);
167 requires (!std::same_as<char_t, void>)
170 rank = derived_type::char_to_rank(chr);
171 return static_cast<derived_type &
>(*this);
193 assert(
static_cast<size_t>(c) <
static_cast<size_t>(
alphabet_size));
195 return static_cast<derived_type &
>(*this);
212 friend constexpr bool operator==(derived_type
const lhs, derived_type
const rhs)
noexcept
221 friend constexpr bool operator!=(derived_type
const lhs, derived_type
const rhs)
noexcept
230 friend constexpr bool operator<(derived_type
const lhs, derived_type
const rhs)
noexcept
239 friend constexpr bool operator>(derived_type
const lhs, derived_type
const rhs)
noexcept
248 friend constexpr bool operator<=(derived_type
const lhs, derived_type
const rhs)
noexcept
257 friend constexpr bool operator>=(derived_type
const lhs, derived_type
const rhs)
noexcept
Core alphabet concept and free function/type trait wrappers.
A CRTP-base that makes defining a custom alphabet easier.
Definition: alphabet_base.hpp:57
friend constexpr bool operator<(derived_type const lhs, derived_type const rhs) noexcept
Checks whether the letter lhs is smaller than rhs.
Definition: alphabet_base.hpp:230
constexpr char_type to_char() const noexcept
Return the letter as a character of char_type.
Definition: alphabet_base.hpp:115
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:203
friend constexpr bool operator==(derived_type const lhs, derived_type const rhs) noexcept
Checks whether the letters lhs and rhs are equal.
Definition: alphabet_base.hpp:212
constexpr derived_type & assign_char(char_type const chr) noexcept
Assign from a character, implicitly converts invalid characters.
Definition: alphabet_base.hpp:165
constexpr alphabet_base() noexcept=default
Defaulted.
constexpr rank_type to_rank() const noexcept
Return the letter's numeric value (rank in the alphabet).
Definition: alphabet_base.hpp:139
friend constexpr bool operator>=(derived_type const lhs, derived_type const rhs) noexcept
Checks whether the letter lhs is bigger than or equal to rhs.
Definition: alphabet_base.hpp:257
friend constexpr bool operator>(derived_type const lhs, derived_type const rhs) noexcept
Checks whether the letter lhs is greater than rhs.
Definition: alphabet_base.hpp:239
friend constexpr bool operator<=(derived_type const lhs, derived_type const rhs) noexcept
Checks whether the letter lhs is smaller than or equal to rhs.
Definition: alphabet_base.hpp:248
friend constexpr bool operator!=(derived_type const lhs, derived_type const rhs) noexcept
Checks whether the letters lhs and rhs are unequal.
Definition: alphabet_base.hpp:221
constexpr derived_type & assign_rank(rank_type const c) noexcept
Assign from a numeric value.
Definition: alphabet_base.hpp:191
rank_type rank
The value of the alphabet letter is stored as the rank.
Definition: alphabet_base.hpp:265
constexpr auto to_rank
Return the rank representation of a (semi-)alphabet object.
Definition: concept.hpp:155
constexpr size_t size
The size of a type pack.
Definition: traits.hpp:151
Provides metaprogramming utilities for integer types.
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
SeqAn specific customisations in the standard namespace.