17 #include <type_traits>
55 template <
typename derived_type,
size_t size,
typename char_t =
char>
59 static_assert(
size != 0,
"alphabet size must be >= 1");
118 return derived_type::rank_to_char(rank);
164 requires (!std::same_as<char_t, void>)
166 rank = derived_type::char_to_rank(chr);
167 return static_cast<derived_type &
>(*this);
189 assert(
static_cast<size_t>(c) <
static_cast<size_t>(
alphabet_size));
191 return static_cast<derived_type &
>(*this);
208 friend constexpr
bool operator==(derived_type
const lhs, derived_type
const rhs) noexcept
217 friend constexpr
bool operator!=(derived_type
const lhs, derived_type
const rhs) noexcept
226 friend constexpr
bool operator<(derived_type
const lhs, derived_type
const rhs) noexcept
235 friend constexpr
bool operator>(derived_type
const lhs, derived_type
const rhs) noexcept
244 friend constexpr
bool operator<=(derived_type
const lhs, derived_type
const rhs) noexcept
253 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
constexpr char_type to_char() const noexcept requires(!std
Return the letter as a character of char_type.
Definition: alphabet_base.hpp:115
constexpr derived_type & assign_char(char_type const chr) noexcept requires(!std
Assign from a character, implicitly converts invalid characters.
Definition: alphabet_base.hpp:163
constexpr friend bool operator==(derived_type const lhs, derived_type const rhs) noexcept
Checks whether the letters lhs and rhs are equal.
Definition: alphabet_base.hpp:208
constexpr friend bool operator>(derived_type const lhs, derived_type const rhs) noexcept
Checks whether the letter lhs is greater than rhs.
Definition: alphabet_base.hpp:235
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:137
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:80
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:199
constexpr friend bool operator<(derived_type const lhs, derived_type const rhs) noexcept
Checks whether the letter lhs is smaller than rhs.
Definition: alphabet_base.hpp:226
constexpr derived_type & assign_rank(rank_type const c) noexcept
Assign from a numeric value.
Definition: alphabet_base.hpp:187
constexpr friend bool operator!=(derived_type const lhs, derived_type const rhs) noexcept
Checks whether the letters lhs and rhs are unequal.
Definition: alphabet_base.hpp:217
constexpr friend 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:253
constexpr friend 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:244
The <concepts> header from C++20's standard library.
requires requires
The rank_type of the semi-alphabet; defined as the return type of seqan3::to_rank....
Definition: alphabet/concept.hpp:164
constexpr auto to_rank
Return the rank representation of a (semi-)alphabet object.
Definition: alphabet/concept.hpp:155
constexpr size_t size
The size of a type pack.
Definition: type_pack/traits.hpp:146
Provides metaprogramming utilities for integer types.
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
SeqAn specific customisations in the standard namespace.