53 template <
typename derived_type,
size_t size,
typename char_t =
char>
57 static_assert(
size != 0,
"alphabet size must be >= 1");
110 requires (!
std::same_as<char_t,
void>)
113 return derived_type::rank_to_char[
rank];
160 requires (!std::same_as<char_t, void>)
164 rank = derived_type::char_to_rank[
static_cast<index_t
>(c)];
165 return static_cast<derived_type &
>(*this);
187 assert(
static_cast<size_t>(c) <
static_cast<size_t>(
alphabet_size));
189 return static_cast<derived_type &
>(*this);
206 friend constexpr
bool operator==(derived_type
const lhs, derived_type
const rhs) noexcept
215 friend constexpr
bool operator!=(derived_type
const lhs, derived_type
const rhs) noexcept
224 friend constexpr
bool operator<(derived_type
const lhs, derived_type
const rhs) noexcept
233 friend constexpr
bool operator>(derived_type
const lhs, derived_type
const rhs) noexcept
242 friend constexpr
bool operator<=(derived_type
const lhs, derived_type
const rhs) noexcept
251 friend constexpr
bool operator>=(derived_type
const lhs, derived_type
const rhs) noexcept
273 template <
typename derived_type,
typename char_t>
304 requires (!
std::same_as<char_t,
void>)
307 return derived_type::char_value;
323 requires (!std::same_as<char_t, void>)
326 return static_cast<derived_type &
>(*this);
332 return static_cast<derived_type &
>(*this);
343 friend constexpr
bool operator==(derived_type
const, derived_type
const) noexcept
349 friend constexpr
bool operator!=(derived_type
const, derived_type
const) noexcept
355 friend constexpr
bool operator<(derived_type
const, derived_type
const) noexcept
361 friend constexpr
bool operator>(derived_type
const, derived_type
const) noexcept
367 friend constexpr
bool operator<=(derived_type
const, derived_type
const) noexcept
373 friend constexpr
bool operator>=(derived_type
const, derived_type
const) noexcept
380 #if SEQAN3_WORKAROUND_GCC_87113
381 bool _bug_workaround{};
Core alphabet concept and free function/type trait wrappers.
constexpr friend bool operator<(derived_type const, derived_type const) noexcept
One letter cannot be smaller than another.
Definition: alphabet_base.hpp:355
constexpr rank_type to_rank() const noexcept
Return the letter's numeric value (rank in the alphabet).
Definition: alphabet_base.hpp:311
constexpr friend bool operator!=(derived_type const, derived_type const) noexcept
Letters are never unequal.
Definition: alphabet_base.hpp:349
constexpr friend bool operator>=(derived_type const, derived_type const) noexcept
Letters are always equal.
Definition: alphabet_base.hpp:373
constexpr derived_type & assign_rank(rank_type const) noexcept
Assign from a numeric value.
Definition: alphabet_base.hpp:330
bool rank_type
The type of the alphabet when represented as a number (e.g. via to_rank()).
Definition: alphabet_base.hpp:283
constexpr friend bool operator<=(derived_type const, derived_type const) noexcept
Letters are always equal.
Definition: alphabet_base.hpp:367
constexpr alphabet_base() noexcept=default
Defaulted.
constexpr friend bool operator>(derived_type const, derived_type const) noexcept
One letter cannot be bigger than another.
Definition: alphabet_base.hpp:361
constexpr derived_type & assign_char(char_type const) noexcept
Assign from a character, implicitly converts invalid characters.
Definition: alphabet_base.hpp:321
constexpr friend bool operator==(derived_type const, derived_type const) noexcept
Letters are always equal.
Definition: alphabet_base.hpp:343
A CRTP-base that makes defining a custom alphabet easier.
Definition: alphabet_base.hpp:55
constexpr char_type to_char() const noexcept
Return the letter as a character of char_type.
Definition: alphabet_base.hpp:108
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:206
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:233
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:132
constexpr derived_type & assign_char(char_type const c) noexcept
Assign from a character, implicitly converts invalid characters.
Definition: alphabet_base.hpp:158
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:197
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:224
constexpr derived_type & assign_rank(rank_type const c) noexcept
Assign from a numeric value.
Definition: alphabet_base.hpp:185
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:215
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:251
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:242
rank_type rank
The value of the alphabet letter is stored as the rank.
Definition: alphabet_base.hpp:259
constexpr auto to_rank
Return the rank representation of a (semi-)alphabet object.
Definition: concept.hpp:146
constexpr size_t size
The size of a type pack.
Definition: traits.hpp:150
Provides metaprogramming utilities for integer types.
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
SeqAn specific customisations in the standard namespace.
Provides C++20 additions to the type_traits header.