32template <
typename tuple_derived_t,
typename rhs_t,
typename... component_types>
35 !std::is_base_of_v<tuple_derived_t, rhs_t>)&&(!(std::same_as<rhs_t, component_types> || ...))
39template <
typename lhs_t,
typename tuple_derived_t,
typename rhs_t,
typename... component_types>
41 (instantiate_if_v<lazy<weakly_equality_comparable_with_trait, rhs_t, component_types>,
42 std::same_as<lhs_t, tuple_derived_t>
47template <
typename lhs_t,
typename tuple_derived_t,
typename rhs_t,
typename... component_types>
49 (instantiate_if_v<lazy<weakly_ordered_with_trait, rhs_t, component_types>,
50 std::same_as<lhs_t, tuple_derived_t>
107template <
typename derived_type,
typename... component_types>
108 requires (detail::writable_constexpr_semialphabet<component_types> && ...) && (std::regular<component_types> && ...)
111 (1 * ... * alphabet_size<component_types>),
117 (1 * ... * alphabet_size<component_types>),
124 template <
typename type>
125 static constexpr bool is_component = seqan3::list_traits::contains<type, component_list>;
128 template <
typename type>
132 template <
typename alphabet_type,
size_t index>
146 using base_t::base_t;
197 template <
typename component_type>
198 requires (!std::is_base_of_v<alphabet_tuple_base, component_type>) && is_unique_component<component_type>
201 get<component_type>(*
this) = alph;
219 template <
typename indirect_component_type>
220 requires ((detail::instantiate_if_v<
221 detail::lazy<std::is_convertible, indirect_component_type, component_types>,
227 constexpr auto component_position =
228 seqan3::list_traits::find_if<component_predicate::template invoke, component_list>;
230 component_type tmp(alph);
231 get<component_type>(*
this) = tmp;
235 template <
typename indirect_component_type>
236 requires ((!(detail::instantiate_if_v<
237 detail::lazy<std::is_convertible, indirect_component_type, component_types>,
240 && (detail::instantiate_if_v<
241 detail::lazy<std::is_constructible, component_types, indirect_component_type>,
242 detail::tuple_general_guard<derived_type, indirect_component_type, component_types...>>
246 using component_predicate = detail::constructible_from<indirect_component_type>;
247 constexpr auto component_position =
248 seqan3::list_traits::find_if<component_predicate::template invoke, component_list>;
250 component_type tmp(alph);
251 get<component_type>(*
this) = tmp;
265 template <
typename component_type>
266 requires (!std::derived_from<component_type, alphabet_tuple_base>) && is_unique_component<component_type>
269 get<component_type>(*
this) = alph;
284 template <
typename indirect_component_type>
285 requires ((!std::derived_from<indirect_component_type, alphabet_tuple_base>)
286 && (!is_unique_component<indirect_component_type>)
287 && (std::assignable_from<component_types, indirect_component_type> || ...))
288 constexpr derived_type &
operator=(indirect_component_type
const alph)
noexcept
291 constexpr auto component_position =
292 seqan3::list_traits::find_if<component_predicate::template invoke, component_list>;
294 get<component_type>(*
this) = alph;
299 template <
typename indirect_component_type>
300 requires ((!std::derived_from<indirect_component_type, alphabet_tuple_base>)
301 && (!is_unique_component<indirect_component_type>)
302 && (!(std::assignable_from<component_types, indirect_component_type> || ...))
303 && (std::convertible_to<indirect_component_type, component_types> || ...))
304 constexpr derived_type &
operator=(indirect_component_type
const alph)
noexcept
307 constexpr auto component_position =
308 seqan3::list_traits::find_if<component_predicate::template invoke, component_list>;
310 component_type tmp(alph);
311 get<component_type>(*
this) = tmp;
315 template <
typename indirect_component_type>
316 requires ((!std::derived_from<indirect_component_type, alphabet_tuple_base>)
317 && (!is_unique_component<indirect_component_type>)
318 && (!(std::assignable_from<component_types, indirect_component_type> || ...))
319 && (!(std::convertible_to<indirect_component_type, component_types> || ...))
320 && (std::constructible_from<component_types, indirect_component_type> || ...))
321 constexpr derived_type &
operator=(indirect_component_type
const alph)
noexcept
323 using component_predicate = detail::constructible_from<indirect_component_type>;
324 constexpr auto component_position =
325 seqan3::list_traits::find_if<component_predicate::template invoke, component_list>;
327 component_type tmp(alph);
328 get<component_type>(*
this) = tmp;
344 template <
size_t index>
347 static_assert(index <
sizeof...(component_types),
"Index out of range.");
363 template <
typename type>
365 requires is_unique_component<type>
367 return get<seqan3::list_traits::find<type, component_list>>(l);
376 template <
size_t index>
379 static_assert(index <
sizeof...(component_types),
"Index out of range.");
392 template <
typename type>
394 requires is_unique_component<type>
396 return get<seqan3::list_traits::find<type, component_list>>(l);
403 template <
typename type>
404 constexpr operator type() const noexcept
407 return get<type>(*
this);
428 template <
typename derived_type_t,
typename indirect_component_type>
429 friend constexpr auto operator==(derived_type_t
const lhs, indirect_component_type
const rhs)
noexcept
435 constexpr auto component_position =
436 seqan3::list_traits::find_if<component_predicate::template invoke, component_list>;
438 return get<component_type>(lhs) == rhs;
442 template <
typename derived_type_t,
typename indirect_component_type>
443 friend constexpr auto operator==(indirect_component_type
const lhs, derived_type_t
const rhs)
noexcept
452 template <
typename derived_type_t,
typename indirect_component_type>
453 friend constexpr auto operator!=(derived_type_t
const lhs, indirect_component_type
const rhs)
noexcept
459 constexpr auto component_position =
460 seqan3::list_traits::find_if<component_predicate::template invoke, component_list>;
462 return get<component_type>(lhs) != rhs;
466 template <
typename derived_type_t,
typename indirect_component_type>
467 friend constexpr auto operator!=(indirect_component_type
const lhs, derived_type_t
const rhs)
noexcept
476 template <
typename derived_type_t,
typename indirect_component_type>
477 friend constexpr auto operator<(derived_type_t
const lhs, indirect_component_type
const rhs)
noexcept
483 constexpr auto component_position =
484 seqan3::list_traits::find_if<component_predicate::template invoke, component_list>;
486 return get<component_type>(lhs) < rhs;
490 template <
typename derived_type_t,
typename indirect_component_type>
491 friend constexpr auto operator<(indirect_component_type
const lhs, derived_type_t
const rhs)
noexcept
500 template <
typename derived_type_t,
typename indirect_component_type>
501 friend constexpr auto operator<=(derived_type_t
const lhs, indirect_component_type
const rhs)
noexcept
507 constexpr auto component_position =
508 seqan3::list_traits::find_if<component_predicate::template invoke, component_list>;
510 return get<component_type>(lhs) <= rhs;
514 template <
typename derived_type_t,
typename indirect_component_type>
515 friend constexpr auto operator<=(indirect_component_type
const lhs, derived_type_t
const rhs)
noexcept
524 template <
typename derived_type_t,
typename indirect_component_type>
525 friend constexpr auto operator>(derived_type_t
const lhs, indirect_component_type
const rhs)
noexcept
531 constexpr auto component_position =
532 seqan3::list_traits::find_if<component_predicate::template invoke, component_list>;
534 return get<component_type>(lhs) > rhs;
538 template <
typename derived_type_t,
typename indirect_component_type>
539 friend constexpr auto operator>(indirect_component_type
const lhs, derived_type_t
const rhs)
noexcept
548 template <
typename derived_type_t,
typename indirect_component_type>
549 friend constexpr auto operator>=(derived_type_t
const lhs, indirect_component_type
const rhs)
noexcept
555 constexpr auto component_position =
556 seqan3::list_traits::find_if<component_predicate::template invoke, component_list>;
558 return get<component_type>(lhs) >= rhs;
562 template <
typename derived_type_t,
typename indirect_component_type>
563 friend constexpr auto operator>=(indirect_component_type
const lhs, derived_type_t
const rhs)
noexcept
574 template <
size_t index>
579 return rank_to_component_rank[index][
to_rank()];
589 template <
size_t index>
593 + ((r -
static_cast<ptrdiff_t
>(to_component_rank<index>()))
615 using reverse_list_t =
decltype(seqan3::list_traits::detail::reverse(
component_list{}));
617 seqan3::detail::for_each<reverse_list_t>(
618 [&](
auto alphabet_type_identity)
constexpr {
619 using alphabet_t =
typename decltype(alphabet_type_identity)::type;
620 ret[count] =
static_cast<rank_type>(seqan3::alphabet_size<alphabet_t> * ret[count - 1]);
639 list_traits::size<component_list>> rank_to_component_rank
643 list_traits::size<component_list>> ret{};
649 for (
size_t i = 0; i < list_traits::size<component_list>; ++i)
650 for (
size_t j = 0; j < static_cast<size_t>(
alphabet_size); ++j)
666template <
typename derived_type,
typename... component_types>
667 requires (detail::writable_constexpr_semialphabet<component_types> && ...) && (std::regular<component_types> && ...)
668template <
typename alphabet_type,
size_t index>
670 public alphabet_proxy<component_proxy<alphabet_type, index>, alphabet_type>
689 using base_t::operator=;
720 return get<index>(lhs) ==
static_cast<alphabet_type
>(rhs);
732 return get<index>(lhs) !=
static_cast<alphabet_type
>(rhs);
744 return get<index>(lhs) <
static_cast<alphabet_type
>(rhs);
756 return get<index>(lhs) <=
static_cast<alphabet_type
>(rhs);
768 return get<index>(lhs) >
static_cast<alphabet_type
>(rhs);
780 return get<index>(lhs) >=
static_cast<alphabet_type
>(rhs);
803template <std::
size_t i, seqan3::detail::alphabet_tuple_like tuple_t>
804struct tuple_element<i, tuple_t>
817template <seqan3::detail::alphabet_tuple_like tuple_t>
Provides implementation detail for seqan3::alphabet_variant and seqan3::alphabet_tuple_base.
Core alphabet concept and free function/type trait wrappers.
Provides seqan3::alphabet_base.
Provides seqan3::alphabet_proxy.
A CRTP-base that makes defining a custom alphabet easier.
Definition alphabet_base.hpp:54
constexpr rank_type to_rank() const noexcept
Return the letter's numeric value (rank in the alphabet).
Definition alphabet_base.hpp:134
detail::min_viable_uint_t< size - 1 > rank_type
The type of the alphabet when represented as a number (e.g. via to_rank()).
Definition alphabet_base.hpp:77
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:196
constexpr derived_type & assign_rank(rank_type const c) noexcept
Assign from a numeric value.
Definition alphabet_base.hpp:184
A CRTP-base that eases the definition of proxy types returned in place of regular alphabets.
Definition alphabet_proxy.hpp:62
Specialisation of seqan3::alphabet_proxy that updates the rank of the alphabet_tuple_base.
Definition alphabet_tuple_base.hpp:671
friend constexpr bool operator!=(component_proxy< alphabet_type, index > const lhs, derived_type const rhs) noexcept
Comparison against the alphabet tuple by casting self and tuple to the emulated type.
Definition alphabet_tuple_base.hpp:736
~component_proxy()=default
Defaulted.
constexpr void on_update() noexcept
The implementation updates the rank in the parent object.
Definition alphabet_tuple_base.hpp:682
constexpr component_proxy(component_proxy const &)=default
Defaulted.
friend constexpr bool operator<=(derived_type const lhs, component_proxy const rhs) noexcept
Comparison against the alphabet tuple by casting self and tuple to the emulated type.
Definition alphabet_tuple_base.hpp:754
friend constexpr bool operator<=(component_proxy< alphabet_type, index > const lhs, derived_type const rhs) noexcept
Comparison against the alphabet tuple by casting self and tuple to the emulated type.
Definition alphabet_tuple_base.hpp:760
constexpr component_proxy & operator=(component_proxy &&)=default
Defaulted.
constexpr component_proxy & operator=(component_proxy const &)=default
Defaulted.
friend constexpr bool operator<(derived_type const lhs, component_proxy const rhs) noexcept
Comparison against the alphabet tuple by casting self and tuple to the emulated type.
Definition alphabet_tuple_base.hpp:742
friend constexpr bool operator>=(derived_type const lhs, component_proxy const rhs) noexcept
Comparison against the alphabet tuple by casting self and tuple to the emulated type.
Definition alphabet_tuple_base.hpp:778
alphabet_tuple_base * parent
Store a pointer to the parent object so we can update it.
Definition alphabet_tuple_base.hpp:679
friend constexpr bool operator==(derived_type const lhs, component_proxy const rhs) noexcept
Comparison against the alphabet tuple by casting self and tuple to the emulated type.
Definition alphabet_tuple_base.hpp:718
friend constexpr bool operator<(component_proxy< alphabet_type, index > const lhs, derived_type const rhs) noexcept
Comparison against the alphabet tuple by casting self and tuple to the emulated type.
Definition alphabet_tuple_base.hpp:748
constexpr component_proxy(alphabet_type const l, alphabet_tuple_base &p)
Construct from an alphabet letter and reference to the parent object.
Definition alphabet_tuple_base.hpp:703
friend constexpr bool operator!=(derived_type const lhs, component_proxy const rhs) noexcept
Comparison against the alphabet tuple by casting self and tuple to the emulated type.
Definition alphabet_tuple_base.hpp:730
friend constexpr bool operator>(component_proxy< alphabet_type, index > const lhs, derived_type const rhs) noexcept
Comparison against the alphabet tuple by casting self and tuple to the emulated type.
Definition alphabet_tuple_base.hpp:772
friend constexpr bool operator==(component_proxy< alphabet_type, index > const lhs, derived_type const rhs) noexcept
Comparison against the alphabet tuple by casting self and tuple to the emulated type.
Definition alphabet_tuple_base.hpp:724
friend constexpr bool operator>(derived_type const lhs, component_proxy const rhs) noexcept
Comparison against the alphabet tuple by casting self and tuple to the emulated type.
Definition alphabet_tuple_base.hpp:766
friend constexpr bool operator>=(component_proxy< alphabet_type, index > const lhs, derived_type const rhs) noexcept
Comparison against the alphabet tuple by casting self and tuple to the emulated type.
Definition alphabet_tuple_base.hpp:784
friend base_t
Befriend the base type so it can call our seqan3::alphabet_tuple_base::component_proxy::on_update().
Definition alphabet_tuple_base.hpp:676
constexpr component_proxy(component_proxy &&)=default
Defaulted.
component_proxy()=delete
Deleted, because using this proxy without parent would be undefined behaviour.
The CRTP base for a combined alphabet that contains multiple values of different alphabets at the sam...
Definition alphabet_tuple_base.hpp:113
~alphabet_tuple_base()=default
Defaulted.
friend constexpr auto get(alphabet_tuple_base &l) noexcept
Tuple-like access to the contained components.
Definition alphabet_tuple_base.hpp:345
friend constexpr type get(alphabet_tuple_base const &l) noexcept
Tuple-like access to the contained components.
Definition alphabet_tuple_base.hpp:393
friend constexpr auto operator==(indirect_component_type const lhs, derived_type_t const rhs) noexcept -> std::enable_if_t< detail::tuple_eq_guard< derived_type_t, derived_type, indirect_component_type, component_types... >, bool >
Comparison against types comparable with components.
Definition alphabet_tuple_base.hpp:443
constexpr rank_type to_component_rank() const noexcept
Return the rank of the i-th component.
Definition alphabet_tuple_base.hpp:575
friend constexpr auto operator>=(derived_type_t const lhs, indirect_component_type const rhs) noexcept -> std::enable_if_t< detail::tuple_order_guard< derived_type_t, derived_type, indirect_component_type, component_types... >, bool >
Comparison against types comparable with components.
Definition alphabet_tuple_base.hpp:549
friend constexpr auto operator<=(indirect_component_type const lhs, derived_type_t const rhs) noexcept -> std::enable_if_t< detail::tuple_order_guard< derived_type_t, derived_type, indirect_component_type, component_types... >, bool >
Comparison against types comparable with components.
Definition alphabet_tuple_base.hpp:515
friend constexpr auto operator<(derived_type_t const lhs, indirect_component_type const rhs) noexcept -> std::enable_if_t< detail::tuple_order_guard< derived_type_t, derived_type, indirect_component_type, component_types... >, bool >
Comparison against types comparable with components.
Definition alphabet_tuple_base.hpp:477
friend constexpr auto operator>(indirect_component_type const lhs, derived_type_t const rhs) noexcept -> std::enable_if_t< detail::tuple_order_guard< derived_type_t, derived_type, indirect_component_type, component_types... >, bool >
Comparison against types comparable with components.
Definition alphabet_tuple_base.hpp:539
static constexpr bool seqan3_alphabet_tuple_like
Make specialisations of this template identifiable in metapgrogramming contexts.
Definition alphabet_tuple_base.hpp:172
friend constexpr auto get(alphabet_tuple_base &l) noexcept
Tuple-like access to the contained components.
Definition alphabet_tuple_base.hpp:364
list_traits::concat< component_list, detail::transformation_trait_or_t< detail::recursive_required_types< component_types >, seqan3::type_list<> >... > seqan3_recursive_required_types
Export this type's components and possibly the components' components in a visible manner.
Definition alphabet_tuple_base.hpp:169
constexpr alphabet_tuple_base(alphabet_tuple_base const &)=default
Defaulted.
constexpr alphabet_tuple_base(indirect_component_type const alph) noexcept
Construction via a value of a subtype that is assignable to one of the components.
Definition alphabet_tuple_base.hpp:224
constexpr alphabet_tuple_base(component_type const alph) noexcept
Construction via a value of one of the components.
Definition alphabet_tuple_base.hpp:199
friend constexpr auto operator>(derived_type_t const lhs, indirect_component_type const rhs) noexcept -> std::enable_if_t< detail::tuple_order_guard< derived_type_t, derived_type, indirect_component_type, component_types... >, bool >
Comparison against types comparable with components.
Definition alphabet_tuple_base.hpp:525
static constexpr rank_type rank_sum_helper(component_types... components, std::index_sequence< idx... > const &) noexcept
For the given components, compute the combined rank.
Definition alphabet_tuple_base.hpp:599
constexpr alphabet_tuple_base(alphabet_tuple_base &&)=default
Defaulted.
static constexpr bool is_unique_component
Is set to true if the type is uniquely contained in the type list.
Definition alphabet_tuple_base.hpp:129
constexpr alphabet_tuple_base() noexcept
Defaulted.
Definition alphabet_tuple_base.hpp:138
seqan3::type_list< component_types... > component_list
A seqan3::type_list The types of each component in the composite.
Definition alphabet_tuple_base.hpp:121
friend constexpr auto operator<(indirect_component_type const lhs, derived_type_t const rhs) noexcept -> std::enable_if_t< detail::tuple_order_guard< derived_type_t, derived_type, indirect_component_type, component_types... >, bool >
Comparison against types comparable with components.
Definition alphabet_tuple_base.hpp:491
friend constexpr auto operator>=(indirect_component_type const lhs, derived_type_t const rhs) noexcept -> std::enable_if_t< detail::tuple_order_guard< derived_type_t, derived_type, indirect_component_type, component_types... >, bool >
Comparison against types comparable with components.
Definition alphabet_tuple_base.hpp:563
friend constexpr auto operator!=(derived_type_t const lhs, indirect_component_type const rhs) noexcept -> std::enable_if_t< detail::tuple_eq_guard< derived_type_t, derived_type, indirect_component_type, component_types... >, bool >
Comparison against types comparable with components.
Definition alphabet_tuple_base.hpp:453
constexpr alphabet_tuple_base(component_types... components) noexcept
Construction from initialiser-list.
Definition alphabet_tuple_base.hpp:182
static constexpr std::array< rank_type, component_list::size()> cummulative_alph_sizes
The cumulative alphabet size products are cached.
Definition alphabet_tuple_base.hpp:608
static constexpr bool is_component
Is set to true if the type is contained in the type list.
Definition alphabet_tuple_base.hpp:125
constexpr void assign_component_rank(ptrdiff_t const r) noexcept
Assign via the rank of i-th component (does not update other components' state).
Definition alphabet_tuple_base.hpp:590
friend constexpr auto operator!=(indirect_component_type const lhs, derived_type_t const rhs) noexcept -> std::enable_if_t< detail::tuple_eq_guard< derived_type_t, derived_type, indirect_component_type, component_types... >, bool >
Comparison against types comparable with components.
Definition alphabet_tuple_base.hpp:467
friend derived_type
Befriend the derived type so that it can instantiate.
Definition alphabet_tuple_base.hpp:151
friend constexpr auto operator==(derived_type_t const lhs, indirect_component_type const rhs) noexcept -> std::enable_if_t< detail::tuple_eq_guard< derived_type_t, derived_type, indirect_component_type, component_types... >, bool >
Comparison against types comparable with components.
Definition alphabet_tuple_base.hpp:429
constexpr alphabet_tuple_base & operator=(alphabet_tuple_base &&)=default
Defaulted.
friend constexpr auto operator<=(derived_type_t const lhs, indirect_component_type const rhs) noexcept -> std::enable_if_t< detail::tuple_order_guard< derived_type_t, derived_type, indirect_component_type, component_types... >, bool >
Comparison against types comparable with components.
Definition alphabet_tuple_base.hpp:501
constexpr alphabet_tuple_base & operator=(alphabet_tuple_base const &)=default
Defaulted.
friend constexpr auto get(alphabet_tuple_base const &l) noexcept
Tuple-like access to the contained components.
Definition alphabet_tuple_base.hpp:377
constexpr auto alphabet_size
A type trait that holds the size of a (semi-)alphabet.
Definition alphabet/concept.hpp:846
constexpr auto assign_rank_to
Assign a rank to an alphabet object.
Definition alphabet/concept.hpp:290
constexpr auto to_rank
Return the rank representation of a (semi-)alphabet object.
Definition alphabet/concept.hpp:152
decltype(detail::concat(lists_t{}...)) concat
Join two seqan3::type_list s into one.
Definition type_list/traits.hpp:339
constexpr bool contains
Whether a type occurs in a type list or not.
Definition type_list/traits.hpp:249
typename decltype(detail::at< idx >(list_t{}))::type at
Return the type at given index from the type list.
Definition type_list/traits.hpp:276
typename decltype(detail::at< idx, pack_t... >())::type at
Return the type at given index from the type pack.
Definition type_pack/traits.hpp:245
typename transformation_trait_or< type_t, default_t >::type transformation_trait_or_t
Helper type of seqan3::detail::transformation_trait_or (transformation_trait shortcut).
Definition transformation_trait_or.hpp:48
Provides metaprogramming utilities for integer types.
Subconcept definition for seqan3::tuple_like to test for std::tuple_size-interface.
The internal SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
constexpr bool tuple_general_guard
Prevents wrong instantiations of seqan3::alphabet_tuple_base's equality comparison operators.
Definition alphabet_tuple_base.hpp:33
constexpr bool tuple_eq_guard
Prevents wrong instantiations of seqan3::alphabet_tuple_base's equality comparison operators.
Definition alphabet_tuple_base.hpp:40
constexpr bool tuple_order_guard
Prevents wrong instantiations of seqan3::alphabet_tuple_base's ordered comparison operators.
Definition alphabet_tuple_base.hpp:48
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
constexpr auto const & get(configuration< configs_t... > const &config) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition configuration.hpp:412
SeqAn specific customisations in the standard namespace.
'Callable' helper class that is invokable by meta::invoke.Returns a std::true_type if the type is ass...
Definition alphabet/composite/detail.hpp:151
'Callable' helper class that is invokable by meta::invoke.Returns a std::true_type if the T is implic...
Definition alphabet/composite/detail.hpp:139
'Callable' helper class that is invokable by meta::invoke.Returns a std::true_type if the type is wea...
Definition alphabet/composite/detail.hpp:163
'Callable' helper class that is invokable by meta::invoke.Returns a std::true_type if the type is com...
Definition alphabet/composite/detail.hpp:175
Type that contains multiple types.
Definition type_list.hpp:26
static constexpr size_t size() noexcept
The number of types contained in the type list.
Definition type_list.hpp:31
seqan3::list_traits::at< i, typename tuple_t::seqan3_required_types > type
Element type.
Definition alphabet_tuple_base.hpp:807
Provides traits for seqan3::type_list.
Provides seqan3::type_list.
Provides algorithms for meta programming, parameter packs and seqan3::type_list.
Provides various traits for template packs.
Provides seqan3::tuple_like.