25 #if 0 // this is the alphabet_proxy I want, but GCC won't give me: 28 template <
typename derived_type,
typename alphabet_type>
29 class alphabet_proxy :
public alphabet_type
32 using base_t = alphabet_type;
35 using typename base_t::rank_type;
36 using char_type = detail::transformation_trait_or_t<std::type_identity<alphabet_char_t<<alphabet_type>,
void>;
37 using phred_type = detail::transformation_trait_or_t<alphabet_phred_t<alphabet_type>,
void>;
39 using char_type_virtual = detail::valid_template_spec_or_t<char, alphabet_char_t, alphabet_type>;
40 using phred_type_virtual = detail::valid_template_spec_or_t<int8_t, alphabet_phred_t, alphabet_type>;
42 constexpr alphabet_proxy() : base_t{} {}
43 constexpr alphabet_proxy(alphabet_proxy
const &) =
default;
44 constexpr alphabet_proxy(alphabet_proxy &&) =
default;
45 constexpr alphabet_proxy & operator=(alphabet_proxy
const &) =
default;
46 constexpr alphabet_proxy & operator=(alphabet_proxy &&) =
default;
47 ~alphabet_proxy() =
default;
49 constexpr alphabet_proxy(alphabet_type
const a) :
53 constexpr alphabet_proxy & operator=(alphabet_type
const & c) noexcept
56 static_cast<derived_type &
>(*this).on_update();
60 template <
typename indirect_assignable_type>
62 constexpr alphabet_proxy & operator=(indirect_assignable_type
const & c) noexcept
69 constexpr alphabet_proxy & assign_char(char_type_virtual
const c) noexcept
75 return operator=(tmp);
78 constexpr alphabet_proxy & assign_rank(alphabet_rank_t<alphabet_type>
const r) noexcept
83 return operator=(tmp);
86 constexpr alphabet_proxy & assign_phred(phred_type_virtual
const c) noexcept
91 return operator=(tmp);
96 #if 1// this is the one that works for most things, but not all 130 template <
typename derived_type, WritableSemialphabet alphabet_type>
132 alphabet_size<alphabet_type>,
133 detail::valid_template_spec_or_t<void, alphabet_char_t, alphabet_type>>
138 alphabet_size<alphabet_type>,
139 detail::valid_template_spec_or_t<void, alphabet_char_t, alphabet_type>>;
145 using char_type = detail::valid_template_spec_or_t<char, alphabet_char_t, alphabet_type>;
148 using phred_type = detail::valid_template_spec_or_t<int8_t, alphabet_phred_t, alphabet_type>;
183 constexpr derived_type & operator=(alphabet_type
const & c) noexcept
186 static_cast<derived_type &
>(*this).on_update();
187 return static_cast<derived_type &
>(*this);
191 template <
typename indirect_assignable_type>
192 constexpr derived_type & operator=(indirect_assignable_type
const & c) noexcept
214 return operator=(tmp);
217 constexpr derived_type & assign_char(char_type
const c) noexcept
222 return operator=(tmp);
225 constexpr derived_type & assign_phred(phred_type
const c) noexcept
226 requires WritableQualityAlphabet<alphabet_type>
230 return operator=(tmp);
238 constexpr
operator alphabet_type()
const noexcept
244 constexpr
auto to_char()
const noexcept
253 constexpr
auto to_phred()
const noexcept
266 return to_phred(
operator alphabet_type());
269 #if 0 // this currently causes GCC ICE in alphabet_tuple_base test 270 constexpr alphabet_type
complement()
const noexcept
274 return complement(static_cast<alphabet_type>(*
this));
282 return char_is_valid_for<alphabet_type>(c);
The generic alphabet concept that covers most data types used in ranges.
Provides concepts for core language types and relations that don't have concepts in C++20 (yet)...
constexpr auto complement
Return the complement of a nucleotide object.
Definition: concept.hpp:104
The concept std::Assignable<LHS, RHS> specifies that an expression of the type and value category spe...
alphabet_rank_t< alphabet_type > rank_type
The type of the rank representation.
Definition: alphabet_proxy.hpp:160
constexpr auto assign_rank_to
Assign a rank to an alphabet object.
Definition: concept.hpp:207
A CRTP-base that eases the definition of proxy types returned in place of regular alphabets...
Definition: alphabet_proxy.hpp:131
A concept that indicates whether an alphabet represents quality scores.
constexpr auto to_char
Return the char representation of an alphabet object.
Definition: concept.hpp:285
constexpr auto to_rank
Return the rank representation of a (semi-)alphabet object.
Definition: concept.hpp:103
Provides seqan3::type_list and auxiliary type traits.
The main SeqAn3 namespace.
constexpr derived_type & assign_rank(rank_type const c) noexcept
Assign from a numeric value.
Definition: alphabet_base.hpp:166
decltype(seqan3::to_rank(std::declval< semi_alphabet_type >())) alphabet_rank_t
The rank_type of the semi-alphabet; defined as the return type of seqan3::to_rank.
Definition: concept.hpp:112
constexpr auto assign_phred_to
Assign a phred score to a quality alphabet object.
Definition: concept.hpp:201
Provides seqan3::NucleotideAlphabet.
Refines seqan3::Alphabet and adds assignability.
static constexpr bool char_is_valid(char_type const c) noexcept requires WritableAlphabet< alphabet_type >
Delegate to the emulated type's validator.
Definition: alphabet_proxy.hpp:279
Provides seqan3::alphabet_base.
constexpr auto to_phred
The public getter function for the phred representation of a quality score.
Definition: concept.hpp:104
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
A concept that indicates whether an alphabet represents nucleotides.
Provides various type traits on generic types.
constexpr rank_type to_rank() const noexcept
Return the letter's numeric value (rank in the alphabet).
Definition: alphabet_base.hpp:117
A CRTP-base that makes defining a custom alphabet easier.
Definition: alphabet_base.hpp:52
constexpr auto assign_char_to
Assign a character to an alphabet object.
Definition: concept.hpp:395
Quality alphabet concept.
The concept std::Same<T, U> is satisfied if and only if T and U denote the same type.
constexpr auto alphabet_size
A type trait that holds the size of a (semi-)alphabet.
Definition: concept.hpp:678
Resolves to std::is_assignable_v<t>.