22 #ifdef SEQAN3_DEPRECATED_310
27 template <
typename alphabet_t>
28 SEQAN3_CONCEPT has_rank_to_char_table = requires()
30 { alphabet_t::rank_to_char[0] };
36 template <
typename alphabet_t>
37 SEQAN3_CONCEPT has_char_to_rank_table = requires()
39 { alphabet_t::char_to_rank[0] };
79 template <
typename derived_type,
size_t size,
typename char_t =
char>
83 static_assert(
size != 0,
"alphabet size must be >= 1");
141 requires (!
std::same_as<char_t,
void>)
144 #ifdef SEQAN3_DEPRECATED_310
145 if constexpr (detail::has_rank_to_char_table<derived_type>)
148 return derived_type::rank_to_char(
rank);
150 return derived_type::rank_to_char(
rank);
154 #ifdef SEQAN3_DEPRECATED_310
163 return derived_type::rank_to_char[
rank];
213 requires (!std::same_as<char_t, void>)
216 #ifdef SEQAN3_DEPRECATED_310
217 if constexpr (detail::has_char_to_rank_table<derived_type>)
220 rank = derived_type::char_to_rank(chr);
222 rank = derived_type::char_to_rank(chr);
225 return static_cast<derived_type &
>(*this);
228 #ifdef SEQAN3_DEPRECATED_310
238 #if SEQAN3_WORKAROUND_GCC_99318
239 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
241 return derived_type::char_to_rank[
static_cast<index_t
>(chr)];
266 assert(
static_cast<size_t>(c) <
static_cast<size_t>(
alphabet_size));
268 return static_cast<derived_type &
>(*this);
285 friend constexpr
bool operator==(derived_type
const lhs, derived_type
const rhs) noexcept
294 friend constexpr
bool operator!=(derived_type
const lhs, derived_type
const rhs) noexcept
303 friend constexpr
bool operator<(derived_type
const lhs, derived_type
const rhs) noexcept
312 friend constexpr
bool operator>(derived_type
const lhs, derived_type
const rhs) noexcept
321 friend constexpr
bool operator<=(derived_type
const lhs, derived_type
const rhs) noexcept
330 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:81
constexpr char_type to_char() const noexcept
Return the letter as a character of char_type.
Definition: alphabet_base.hpp:139
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:285
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:312
static constexpr rank_type char_to_rank_table(char_type const chr) noexcept
Before SeqAn 3.0.3, we defined derived_type::char_to_rank as a lookup table. We relaxed this to be a ...
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:185
static constexpr char_type rank_to_char_table(rank_type const rank) noexcept
Before SeqAn 3.0.3, we defined derived_type::rank_to_char_table as a lookup table....
Definition: alphabet_base.hpp:161
constexpr derived_type & assign_char(char_type const chr) noexcept
Assign from a character, implicitly converts invalid characters.
Definition: alphabet_base.hpp:211
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:276
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:303
constexpr derived_type & assign_rank(rank_type const c) noexcept
Assign from a numeric value.
Definition: alphabet_base.hpp:264
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:294
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:330
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:321
rank_type rank
The value of the alphabet letter is stored as the rank.
Definition: alphabet_base.hpp:338
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:150
Provides metaprogramming utilities for integer types.
The internal SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
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.