70inline constexpr auto to_rank = []<
typename alph_t>(alph_t
const a)
noexcept
78 return tag_invoke(custom::to_rank{}, a);
84template <
typename semi_alphabet_type>
143 } -> std::same_as<alph_t &>;
147 return tag_invoke(custom::assign_rank_to{}, r, a);
192inline constexpr auto to_char = []<
typename alph_t>(alph_t
const a)
noexcept
200 return tag_invoke(custom::to_char{}, a);
206template <
typename alphabet_type>
207 requires(
requires(alphabet_type
const a) {
265 } -> std::same_as<alph_t &>;
269 return tag_invoke(custom::assign_char_to{}, c, a);
278namespace bio::alphabet::detail
283template <
typename alph_t>
284struct char_is_valid_for_fn
287 template <
typename alph2_t>
288 static constexpr bool impl(char_t<alph2_t>
const chr, meta::priority_tag<0>)
noexcept
289 requires std::is_nothrow_default_constructible_v<alph2_t>
295 template <
typename alph2_t,
typename wrap_t = meta::default_initialisable_wrap_t<alph2_t>>
296 requires(
requires(char_t<alph2_t>
const c) {
298 tag_invoke(std::declval<custom::char_is_valid_for>(), c, wrap_t{})
299 } -> std::same_as<bool>;
300 requires noexcept(
tag_invoke(std::declval<custom::char_is_valid_for>(), c, wrap_t{}));
302 static constexpr bool impl(char_t<alph2_t>
const chr, meta::priority_tag<1>)
noexcept
304 return tag_invoke(custom::char_is_valid_for{}, chr, wrap_t{});
308 constexpr auto operator()(char_t<alph_t>
const chr)
const noexcept
309 ->
decltype(impl<std::remove_cvref_t<alph_t>>(chr, meta::priority_tag<1>{}))
311 return impl<std::remove_cvref_t<alph_t>>(chr, meta::priority_tag<1>{});
389template <
typename alph_t>
390 requires(
requires(char_t<alph_t> a) {
392 detail::char_is_valid_for_fn<alph_t>{}(a)
405namespace bio::alphabet::detail
410struct assign_char_strictly_to_fn
413 template <
typename alph_t>
419 bio::alphabet::char_is_valid_for<alph_t>(r)
424 if (!bio::alphabet::char_is_valid_for<alph_t>(r))
510template <
typename alph_t,
typename wrap_t = meta::default_initialisable_wrap_t<alph_t>>
513 tag_invoke(custom::size{}, wrap_t{})
563 std::totally_ordered<t> && std::copy_constructible<t> && std::is_nothrow_copy_constructible_v<t> &&
requires(t v) {
565 bio::alphabet::size<t>
694 bio::alphabet::char_is_valid_for<t>(c)
703#if __has_include(<cereal/details/traits.hpp>)
704# include <cereal/details/traits.hpp>
707namespace bio::alphabet::detail
714#if __has_include(<cereal/details/traits.hpp>)
715template <
typename type>
716using strip_cereal_wrapper_t =
typename cereal::traits::strip_minimal<std::decay_t<type>>::type;
718template <
typename type>
719using strip_cereal_wrapper_t = type;
746template <
typename archive_t, semialphabet alphabet_t>
747rank_t<alphabet_t> save_minimal(archive_t
const &, alphabet_t
const & l)
765template <
typename archive_t,
typename wrapped_alphabet_t>
766void load_minimal(archive_t
const &,
767 wrapped_alphabet_t && l,
768 rank_t<detail::strip_cereal_wrapper_t<wrapped_alphabet_t>>
const & r)
769 requires semialphabet<detail::strip_cereal_wrapper_t<wrapped_alphabet_t>>
771 assign_rank_to(r,
static_cast<detail::strip_cereal_wrapper_t<wrapped_alphabet_t> &
>(l));
779namespace bio::alphabet::detail
793concept constexpr_semialphabet = semialphabet<t> &&
requires {
811concept writable_constexpr_semialphabet = constexpr_semialphabet<t> && writable_semialphabet<t> &&
requires {
813#if BIOCPP_WORKAROUND_CLANG_58078
833concept constexpr_alphabet = constexpr_semialphabet<t> && alphabet<t> &&
requires {
853concept writable_constexpr_alphabet =
854 constexpr_alphabet<t> && writable_constexpr_semialphabet<t> && writable_alphabet<t> &&
requires {
856#if !BIOCPP_WORKAROUND_CLANG_58078
Provides various type traits on generic types.
The generic alphabet concept that covers most data types used in ranges.
Definition: concept.hpp:643
The basis for bio::alphabet::alphabet, but requires only rank interface (not char).
Definition: concept.hpp:562
Refines bio::alphabet::alphabet and adds assignability.
Definition: concept.hpp:688
A refinement of bio::alphabet::semialphabet that adds assignability.
Definition: concept.hpp:608
Provides platform and dependency checks.
Provides concepts for core language types and relations that don't have concepts in C++20 (yet).
Exceptions thrown by entities in the alphabet module.
consteval auto tag_invoke(size, char_type const) noexcept
The number of values the char type can take (e.g. 256 for char).
Definition: char.hpp:43
constexpr auto to_char
Return the char representation of an alphabet object.
Definition: concept.hpp:192
constexpr auto assign_char_to
Assign a char to an alphabet object.
Definition: concept.hpp:260
constexpr auto size
A type trait that holds the size of a (semi-)alphabet.
Definition: concept.hpp:517
constexpr auto to_rank
Return the rank representation of a (semi-)alphabet object.
Definition: concept.hpp:70
constexpr auto char_is_valid_for
Returns whether a character is in the valid set of a bio::alphabet::alphabet (usually implies a bijec...
Definition: concept.hpp:395
decltype(bio::alphabet::to_char(std::declval< alphabet_type const >())) char_t
The char_type of the alphabet; defined as the return type of bio::alphabet::to_char.
Definition: concept.hpp:212
decltype(bio::alphabet::to_rank(std::declval< semi_alphabet_type >())) rank_t
The rank_type of the semi-alphabet; defined as the return type of bio::alphabet::to_rank.
Definition: concept.hpp:90
constexpr auto assign_rank_to
Assign a rank to an alphabet object.
Definition: concept.hpp:138
constexpr auto assign_char_strictly_to
Assign a character to an alphabet object, throw if the character is not valid.
Definition: concept.hpp:461
#define BIOCPP_IS_CONSTEXPR(...)
Returns true if the expression passed to this macro can be evaluated at compile time,...
Definition: core.hpp:182
The alphabet module's namespace.
Definition: aa10li.hpp:23
provides bio::meta::priority_tag.
Customisation tag for bio::alphabet::assign_char_to.
Definition: tag.hpp:37
Customisation tag for bio::alphabet::assign_rank_to.#.
Definition: tag.hpp:29
CPO tag definition for bio::alphabet::size.
Definition: tag.hpp:45
Customisation tag for bio::alphabet::to_char.
Definition: tag.hpp:33
Customisation tag for bio::alphabet::to_rank.
Definition: tag.hpp:25
An exception typically thrown by bio::alphabet::assign_char_strict.
Definition: exception.hpp:27
Provides the customisation tags for the alphabet concepts.
Provides traits to inspect some information of a type, for example its name.