45 template <typename alph_t>
47 requires requires (alph_t
const a) { { impl(priority_tag<2>{}, a) }; }
49 constexpr
auto operator()(alph_t
const a)
const noexcept
51 static_assert(noexcept(impl(priority_tag<2>{}, a)),
52 "Only overloads that are marked noexcept are picked up by seqan3::to_rank().");
54 "The return type of your to_rank() implementation must be convertible to size_t.");
56 return impl(priority_tag<2>{}, a);
103 inline constexpr
auto to_rank = detail::adl::only::to_rank_fn{};
108 template <
typename semi_alphabet_type>
110 requires requires { {
seqan3::to_rank(std::declval<semi_alphabet_type>()) }; }
125 struct assign_rank_to_fn
134 template <typename alph_t>
137 { { impl(priority_tag<2>{}, a, r) }; }
141 static_assert(noexcept(impl(priority_tag<2>{}, a, r)),
142 "Only overloads that are marked noexcept are picked up by seqan3::assign_rank_to().");
143 static_assert(
std::Same<alph_t &, decltype(impl(priority_tag<2>{}, a, r))>,
144 "The return type of your assign_rank_to() implementation must be 'alph_t &'.");
146 return impl(priority_tag<2>{}, a, r);
150 template <
typename alph_t>
153 { { impl(priority_tag<2>{}, a, r) }; } && (!std::is_lvalue_reference_v<alph_t>)
157 return (*
this)(r, a);
228 template <typename alph_t>
230 requires requires (alph_t
const a) { { impl(priority_tag<2>{}, a) }; }
232 constexpr decltype(
auto) operator()(alph_t const a) const noexcept
234 static_assert(noexcept(impl(priority_tag<2>{}, a)),
235 "Only overloads that are marked noexcept are picked up by seqan3::to_char().");
237 return impl(priority_tag<2>{}, a);
285 inline constexpr
auto to_char = detail::adl::only::to_char_fn{};
290 template <
typename alphabet_type>
313 struct assign_char_to_fn
322 template <typename alph_t>
325 { { impl(priority_tag<2>{}, a, r) }; }
329 static_assert(noexcept(impl(priority_tag<2>{}, a, r)),
330 "Only overloads that are marked noexcept are picked up by seqan3::assign_char_to().");
331 static_assert(
std::Same<alph_t &, decltype(impl(priority_tag<2>{}, a, r))>,
332 "The return type of your assign_char_to() implementation must be 'alph_t &'.");
334 return impl(priority_tag<2>{}, a, r);
338 template <
typename alph_t>
341 { { impl(priority_tag<2>{}, a, r) }; } && (!std::is_lvalue_reference_v<alph_t>)
345 return (*
this)(r, a);
417 template <
typename alph_t,
419 remove_cvref_t<alph_t>,
421 struct char_is_valid_for_fn
426 SEQAN3_CPO_IMPL(1, (deferred_type_t<remove_cvref_t<alph_t>, decltype(v)>::char_is_valid(v) ))
431 template <
typename dummy =
int>
433 requires requires (alphabet_char_t<alph_t>
const a) { { impl(priority_tag<3>{}, a, dummy{}) }; }
435 constexpr
bool operator()(alphabet_char_t<alph_t>
const a)
const noexcept
437 static_assert(noexcept(impl(priority_tag<3>{}, a)),
438 "Only overloads that are marked noexcept are picked up by seqan3::char_is_valid_for().");
439 static_assert(
std::Same<
bool, decltype(impl(priority_tag<3>{}, a))>,
440 "The return type of your char_is_valid_for() implementation must be 'bool'.");
442 return impl(priority_tag<3>{}, a);
497 template <
typename alph_t>
499 requires requires { {
to_char(std::declval<alph_t>()) }; }
514 struct assign_char_strictly_to_fn
517 template <
typename alph_t>
522 { seqan3::char_is_valid_for<alph_t>(r) } -> bool;
527 if (!seqan3::char_is_valid_for<alph_t>(r))
534 template <
typename alph_t>
539 { seqan3::char_is_valid_for<alph_t>(r) } -> bool;
544 return operator()(r, a);
592 template <
typename alph_t,
594 seqan3::is_constexpr_default_constructible_v<remove_cvref_t<alph_t>>,
595 remove_cvref_t<alph_t>,
597 struct alphabet_size_fn
606 template <
typename dummy =
int>
608 requires requires { { impl(priority_tag<2>{}, s_alph_t{}, dummy{}) }; }
610 constexpr
auto operator()() const noexcept
612 static_assert(noexcept(impl(priority_tag<2>{}, s_alph_t{})),
613 "Only overloads that are marked noexcept are picked up by seqan3::alphabet_size.");
614 static_assert(
std::Constructible<
size_t, decltype(impl(priority_tag<2>{}, s_alph_t{}))>,
615 "The return type of your alphabet_size implementation must be convertible to size_t.");
617 "Only overloads that are marked constexpr are picked up by seqan3::alphabet_size.");
619 return impl(priority_tag<2>{}, s_alph_t{});
625 template <
typename alph_t>
626 requires requires { { alphabet_size_fn<alph_t>{} }; }
627 inline constexpr
auto alphabet_size_obj = alphabet_size_fn<alph_t>{};
673 template <
typename alph_t>
675 requires requires { { detail::adl::only::alphabet_size_fn<alph_t>{} }; } &&
676 requires { { detail::adl::only::alphabet_size_obj<alph_t>() }; }
678 inline constexpr
auto alphabet_size = detail::adl::only::alphabet_size_obj<alph_t>();
723 template <
typename t>
728 std::is_nothrow_copy_constructible_v<t> &&
731 requires seqan3::alphabet_size<t> >= 0;
773 template <
typename t>
775 SEQAN3_CONCEPT WritableSemialphabet = Semialphabet<t> && requires (t v, alphabet_rank_t<t> r)
825 template <
typename t>
827 SEQAN3_CONCEPT Alphabet = Semialphabet<t> && requires (t v)
872 template <
typename t>
874 SEQAN3_CONCEPT WritableAlphabet = Alphabet<t> && WritableSemialphabet<t> && requires (t v, alphabet_char_t<t> c)
878 { seqan3::char_is_valid_for<t>(c) };
905 template <CerealOutputArchive archive_t, Semialphabet alphabet_t>
906 alphabet_rank_t<alphabet_t> CEREAL_SAVE_MINIMAL_FUNCTION_NAME(archive_t
const &, alphabet_t
const & l)
924 template <CerealInputArchive archive_t,
typename wrapped_alphabet_t>
925 void CEREAL_LOAD_MINIMAL_FUNCTION_NAME(archive_t
const &,
926 wrapped_alphabet_t && l,
927 alphabet_rank_t<detail::strip_cereal_wrapper_t<wrapped_alphabet_t>>
const & r)
928 requires Semialphabet<detail::strip_cereal_wrapper_t<wrapped_alphabet_t>>
930 assign_rank_to(r,
static_cast<detail::strip_cereal_wrapper_t<wrapped_alphabet_t> &
>(l));
952 template <
typename t>
954 SEQAN3_CONCEPT ConstexprSemialphabet = Semialphabet<t> && requires
974 template <
typename t>
976 SEQAN3_CONCEPT WritableConstexprSemialphabet = ConstexprSemialphabet<t> && WritableSemialphabet<t> && requires
996 template <
typename t>
998 SEQAN3_CONCEPT ConstexprAlphabet = ConstexprSemialphabet<t> && Alphabet<t> && requires
1020 template <
typename t>
1022 SEQAN3_CONCEPT WritableConstexprAlphabet =
1023 ConstexprAlphabet<t> && WritableConstexprSemialphabet<t> && WritableAlphabet<t> && requires
Exceptions thrown by entities in the alphabet module.
Provides concepts for core language types and relations that don't have concepts in C++20 (yet)...
constexpr auto char_is_valid_for
Returns whether a character is in the valid set of a seqan3::Alphabet (usually implies a bijective ma...
Definition: concept.hpp:501
constexpr char_type to_char(char_type const chr) noexcept
Converting char to char is no-op (it will just return the value you pass in).
Definition: char.hpp:79
constexpr auto assign_rank_to
Assign a rank to an alphabet object.
Definition: concept.hpp:207
#define SEQAN3_CPO_IMPL(PRIO, TERM)
A macro that helps defining the overload set of a customisation point.
Definition: customisation_point.hpp:45
constexpr auto to_char
Return the char representation of an alphabet object.
Definition: concept.hpp:285
The basis for seqan3::Alphabet, but requires only rank interface (not char).
Definition: concept.hpp:32
constexpr auto to_rank
Return the rank representation of a (semi-)alphabet object.
Definition: concept.hpp:103
constexpr auto assign_char_strictly_to
Assign a character to an alphabet object, throw if the character is not valid.
Definition: concept.hpp:577
Provides alphabet adaptations for standard uint types.
The main SeqAn3 namespace.
The concept std::CopyConstructible is satisfied if T is an lvalue reference type, or if it is a MoveC...
#define SEQAN3_IS_CONSTEXPR(...)
Returns true if the expression passed to this macro can be evaluated at compile time, false otherwise.
Definition: function.hpp:25
Provides alphabet adaptations for standard char types.
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
Provides various type traits for use on functions.
decltype(seqan3::to_char(std::declval< alphabet_type const >())) alphabet_char_t
The char_type of the alphabet; defined as the return type of seqan3::to_char.
Definition: concept.hpp:294
constexpr auto to_rank(char_type const chr) noexcept
Convert char to rank by casting to an unsigned integral type of same size.
Definition: char.hpp:93
Adaptions of concepts from the Cereal library.
Helper utilities for defining customisation point objects.
Definition: aligned_sequence_concept.hpp:35
The std::Constructible concept specifies that a variable of type T can be initialized with the given ...
constexpr char_type & assign_rank_to(decltype(to_rank(char_type{})) const rank, char_type &chr) noexcept
Assigning a rank to a char is the same as assigning it a numeric value.
Definition: char.hpp:123
constexpr auto alphabet_size(char_type const &chr) noexcept
Return the number of values the char type can take.
Definition: char.hpp:65
Provides various type traits on generic types.
constexpr char_type & assign_char_to(char_type const chr2, char_type &chr) noexcept
Assign a char to the char type (same as calling =).
Definition: char.hpp:108
The identity transformation (a TransformationTrait that returns the input).
Definition: type_traits:30
Requires std::EqualityComparable and all remaing comparison operators (<, <=, >, >=).
A namespace for third party and standard library specialisations of SeqAn customisation points...
Definition: char.hpp:47
Provides overloads for std::hash.
constexpr auto assign_char_to
Assign a character to an alphabet object.
Definition: concept.hpp:395
Static reflection for arbitrary types.
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
An exception typically thrown by seqan3::Alphabet::assign_char_strict.
Definition: exception.hpp:25