SeqAn3 3.2.0-rc.1
The Modern C++ library for sequence analysis.
alphabet_tuple_base.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2021, Knut Reinert & MPI für molekulare Genetik
4// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5// shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6// -----------------------------------------------------------------------------------------------------
7
13#pragma once
14
15#include <cassert>
16#include <concepts>
17#include <utility>
18
30
31namespace seqan3::detail
32{
33
35template <typename tuple_derived_t, typename rhs_t, typename ... component_types>
36inline constexpr bool tuple_general_guard =
37 (!std::same_as<rhs_t, tuple_derived_t>) &&
38 (!std::same_as<rhs_t, alphabet_tuple_base<component_types...>>) &&
39 (!std::is_base_of_v<tuple_derived_t, rhs_t>) &&
40 (!(std::same_as<rhs_t, component_types> || ...)) &&
41 (!list_traits::contains<tuple_derived_t, recursive_required_types_t<rhs_t>>);
42
43
45template <typename lhs_t, typename tuple_derived_t, typename rhs_t, typename ... component_types>
46inline constexpr bool tuple_eq_guard =
47 (instantiate_if_v<lazy<weakly_equality_comparable_with_trait, rhs_t, component_types>,
48 std::same_as<lhs_t, tuple_derived_t> &&
49 tuple_general_guard<tuple_derived_t, rhs_t, component_types...>
50 > || ...);
51
53template <typename lhs_t, typename tuple_derived_t, typename rhs_t, typename ... component_types>
54inline constexpr bool tuple_order_guard =
55 (instantiate_if_v<lazy<weakly_ordered_with_trait, rhs_t, component_types>,
56 std::same_as<lhs_t, tuple_derived_t> &&
57 tuple_general_guard<lhs_t, tuple_derived_t, rhs_t, component_types...>
58 > || ...);
59
60} // namespace seqan3::detail
61
62namespace seqan3
63{
64
65// forwards
67template <typename t>
68decltype(auto) get();
69
70template <size_t i>
71decltype(auto) get();
73
113template <typename derived_type,
114 typename ...component_types>
116 requires (detail::writable_constexpr_semialphabet<component_types> && ...) &&
117 (std::regular<component_types> && ...)
120 public alphabet_base<derived_type,
121 (1 * ... * alphabet_size<component_types>),
122 void> // no char type, because this is only semi_alphabet
123{
124private:
127 (1 * ... * alphabet_size<component_types>),
128 void>; // no char type, because this is only semi_alphabet
129
131 using component_list = seqan3::type_list<component_types...>;
132
134 template <typename type>
135 static constexpr bool is_component = seqan3::list_traits::contains<type, component_list>;
136
138 template <typename type>
139 static constexpr bool is_unique_component = (seqan3::list_traits::count<type, component_list> == 1);
140
141 // forward declaration: see implementation below
142 template <typename alphabet_type, size_t index>
143 class component_proxy;
144
148 constexpr alphabet_tuple_base() noexcept : base_t{} {}
149 constexpr alphabet_tuple_base(alphabet_tuple_base const &) = default;
150 constexpr alphabet_tuple_base(alphabet_tuple_base &&) = default;
151 constexpr alphabet_tuple_base & operator=(alphabet_tuple_base const &) = default;
154
155 using base_t::base_t;
157
161
162 // Import from base:
163 using typename base_t::rank_type;
164
165public:
166 // Import from base:
168 using base_t::to_rank;
170
182 static constexpr bool seqan3_alphabet_tuple_like = true;
183
192 constexpr alphabet_tuple_base(component_types ... components) noexcept
193 {
194 assign_rank(rank_sum_helper(components..., std::make_index_sequence<sizeof...(component_types)>{}));
195 }
196
207 template <typename component_type>
209 requires (!std::is_base_of_v<alphabet_tuple_base, component_type>) &&
210 is_unique_component<component_type>
212 constexpr explicit alphabet_tuple_base(component_type const alph) noexcept : alphabet_tuple_base{}
213 {
214 get<component_type>(*this) = alph;
215 }
216
232 template <typename indirect_component_type>
234 requires ((detail::instantiate_if_v<
235 detail::lazy<std::is_convertible, indirect_component_type, component_types>,
236 detail::tuple_general_guard<derived_type, indirect_component_type, component_types...>> || ...))
238 constexpr explicit alphabet_tuple_base(indirect_component_type const alph) noexcept : alphabet_tuple_base{}
239 {
241 constexpr auto component_position = seqan3::list_traits::find_if<component_predicate::template invoke,
244 component_type tmp(alph); // delegate construction
245 get<component_type>(*this) = tmp;
246 }
247
249 template <typename indirect_component_type>
250 requires ((!(detail::instantiate_if_v<
251 detail::lazy<std::is_convertible, indirect_component_type, component_types>,
252 detail::tuple_general_guard<derived_type, indirect_component_type, component_types...>> || ...)) &&
253 (detail::instantiate_if_v<
254 detail::lazy<std::is_constructible, component_types, indirect_component_type>,
255 detail::tuple_general_guard<derived_type, indirect_component_type, component_types...>> || ...))
256 constexpr explicit alphabet_tuple_base(indirect_component_type const alph) noexcept : alphabet_tuple_base{}
257 {
258 using component_predicate = detail::constructible_from<indirect_component_type>;
259 constexpr auto component_position = seqan3::list_traits::find_if<component_predicate::template invoke,
262 component_type tmp(alph); // delegate construction
263 get<component_type>(*this) = tmp;
264 }
266
277 template <typename component_type>
279 requires (!std::derived_from<component_type, alphabet_tuple_base>) &&
280 is_unique_component<component_type>
282 constexpr derived_type & operator=(component_type const alph) noexcept
283 {
284 get<component_type>(*this) = alph;
285 return static_cast<derived_type &>(*this);
286 }
287
299 template <typename indirect_component_type>
301 requires ((!std::derived_from<indirect_component_type, alphabet_tuple_base>) &&
302 (!is_unique_component<indirect_component_type>) &&
303 (std::assignable_from<component_types, indirect_component_type> || ...))
305 constexpr derived_type & operator=(indirect_component_type const alph) noexcept
306 {
307 using component_predicate = detail::assignable_from<indirect_component_type>;
308 constexpr auto component_position = seqan3::list_traits::find_if<component_predicate::template invoke,
311 get<component_type>(*this) = alph; // delegate assignment
312 return static_cast<derived_type &>(*this);
313 }
315 // If not assignable but implicit convertible, convert first and assign afterwards
316 template <typename indirect_component_type>
317 requires ((!std::derived_from<indirect_component_type, alphabet_tuple_base>) &&
318 (!is_unique_component<indirect_component_type>) &&
319 (!(std::assignable_from<component_types, indirect_component_type> || ...)) &&
320 (std::convertible_to<indirect_component_type, component_types> || ...))
321 constexpr derived_type & operator=(indirect_component_type const alph) noexcept
322 {
324 constexpr auto component_position = seqan3::list_traits::find_if<component_predicate::template invoke,
327 component_type tmp(alph);
328 get<component_type>(*this) = tmp;
329 return static_cast<derived_type &>(*this);
330 }
331
332 template <typename indirect_component_type>
333 requires ((!std::derived_from<indirect_component_type, alphabet_tuple_base>) &&
334 (!is_unique_component<indirect_component_type>) &&
335 (!(std::assignable_from<component_types, indirect_component_type> || ...)) &&
336 (!(std::convertible_to<indirect_component_type, component_types> || ...)) &&
337 (std::constructible_from<component_types, indirect_component_type> || ...))
338 constexpr derived_type & operator=(indirect_component_type const alph) noexcept
339 {
340 using component_predicate = detail::constructible_from<indirect_component_type>;
341 constexpr auto component_position = seqan3::list_traits::find_if<component_predicate::template invoke,
344 component_type tmp(alph); // delegate construction
345 get<component_type>(*this) = tmp;
346 return static_cast<derived_type &>(*this);
347 }
350
361 template <size_t index>
362 friend constexpr auto get(alphabet_tuple_base & l) noexcept
363 {
364 static_assert(index < sizeof...(component_types), "Index out of range.");
365
367 t val{};
368
369 seqan3::assign_rank_to(l.to_component_rank<index>(), val);
370
371 return component_proxy<t, index>{val, l};
372 }
373
380 template <typename type>
381 friend constexpr auto get(alphabet_tuple_base & l) noexcept
383 requires is_unique_component<type>
385 {
386 return get<seqan3::list_traits::find<type, component_list>>(l);
387 }
388
395 template <size_t index>
396 friend constexpr auto get(alphabet_tuple_base const & l) noexcept
397 {
398 static_assert(index < sizeof...(component_types), "Index out of range.");
399
401
402 return seqan3::assign_rank_to(l.to_component_rank<index>(), t{});
403 }
404
411 template <typename type>
412 friend constexpr type get(alphabet_tuple_base const & l) noexcept
414 requires is_unique_component<type>
416 {
417 return get<seqan3::list_traits::find<type, component_list>>(l);
418 }
419
424 template <typename type>
425 constexpr operator type() const noexcept
427 requires is_unique_component<type>
429 {
430 return get<type>(*this);
431 }
433
451 template <typename derived_type_t, typename indirect_component_type>
452 friend constexpr auto operator==(derived_type_t const lhs, indirect_component_type const rhs) noexcept
453 -> std::enable_if_t<detail::tuple_eq_guard<derived_type_t, derived_type, indirect_component_type, component_types...>,
454 bool>
455 {
457 constexpr auto component_position = seqan3::list_traits::find_if<component_predicate::template invoke,
460 return get<component_type>(lhs) == rhs;
461 }
462
464 template <typename derived_type_t, typename indirect_component_type>
465 friend constexpr auto operator==(indirect_component_type const lhs, derived_type_t const rhs) noexcept
466 -> std::enable_if_t<detail::tuple_eq_guard<derived_type_t, derived_type, indirect_component_type, component_types...>,
467 bool>
468 {
469 return rhs == lhs;
470 }
471
473 template <typename derived_type_t, typename indirect_component_type>
474 friend constexpr auto operator!=(derived_type_t const lhs, indirect_component_type const rhs) noexcept
475 -> std::enable_if_t<detail::tuple_eq_guard<derived_type_t, derived_type, indirect_component_type, component_types...>,
476 bool>
477 {
479 constexpr auto component_position = seqan3::list_traits::find_if<component_predicate::template invoke,
482 return get<component_type>(lhs) != rhs;
483 }
484
486 template <typename derived_type_t, typename indirect_component_type>
487 friend constexpr auto operator!=(indirect_component_type const lhs, derived_type_t const rhs) noexcept
488 -> std::enable_if_t<detail::tuple_eq_guard<derived_type_t, derived_type, indirect_component_type, component_types...>,
489 bool>
490 {
491 return rhs != lhs;
492 }
493
495 template <typename derived_type_t, typename indirect_component_type>
496 friend constexpr auto operator<(derived_type_t const lhs, indirect_component_type const rhs) noexcept
497 -> std::enable_if_t<detail::tuple_order_guard<derived_type_t, derived_type, indirect_component_type, component_types...>,
498 bool>
499 {
501 constexpr auto component_position = seqan3::list_traits::find_if<component_predicate::template invoke,
504 return get<component_type>(lhs) < rhs;
505 }
506
508 template <typename derived_type_t, typename indirect_component_type>
509 friend constexpr auto operator<(indirect_component_type const lhs, derived_type_t const rhs) noexcept
510 -> std::enable_if_t<detail::tuple_order_guard<derived_type_t, derived_type, indirect_component_type, component_types...>,
511 bool>
512 {
513 return rhs > lhs;
514 }
515
517 template <typename derived_type_t, typename indirect_component_type>
518 friend constexpr auto operator<=(derived_type_t const lhs, indirect_component_type const rhs) noexcept
519 -> std::enable_if_t<detail::tuple_order_guard<derived_type_t, derived_type, indirect_component_type, component_types...>,
520 bool>
521 {
523 constexpr auto component_position = seqan3::list_traits::find_if<component_predicate::template invoke,
526 return get<component_type>(lhs) <= rhs;
527 }
528
530 template <typename derived_type_t, typename indirect_component_type>
531 friend constexpr auto operator<=(indirect_component_type const lhs, derived_type_t const rhs) noexcept
532 -> std::enable_if_t<detail::tuple_order_guard<derived_type_t, derived_type, indirect_component_type, component_types...>,
533 bool>
534 {
535 return rhs >= lhs;
536 }
537
539 template <typename derived_type_t, typename indirect_component_type>
540 friend constexpr auto operator>(derived_type_t const lhs, indirect_component_type const rhs) noexcept
541 -> std::enable_if_t<detail::tuple_order_guard<derived_type_t, derived_type, indirect_component_type, component_types...>,
542 bool>
543 {
545 constexpr auto component_position = seqan3::list_traits::find_if<component_predicate::template invoke,
548 return get<component_type>(lhs) > rhs;
549 }
550
552 template <typename derived_type_t, typename indirect_component_type>
553 friend constexpr auto operator>(indirect_component_type const lhs, derived_type_t const rhs) noexcept
554 -> std::enable_if_t<detail::tuple_order_guard<derived_type_t, derived_type, indirect_component_type, component_types...>,
555 bool>
556 {
557 return rhs < lhs;
558 }
559
561 template <typename derived_type_t, typename indirect_component_type>
562 friend constexpr auto operator>=(derived_type_t const lhs, indirect_component_type const rhs) noexcept
563 -> std::enable_if_t<detail::tuple_order_guard<derived_type_t, derived_type, indirect_component_type, component_types...>,
564 bool>
565 {
567 constexpr auto component_position = seqan3::list_traits::find_if<component_predicate::template invoke,
570 return get<component_type>(lhs) >= rhs;
571 }
572
574 template <typename derived_type_t, typename indirect_component_type>
575 friend constexpr auto operator>=(indirect_component_type const lhs, derived_type_t const rhs) noexcept
576 -> std::enable_if_t<detail::tuple_order_guard<derived_type_t, derived_type, indirect_component_type, component_types...>,
577 bool>
578 {
579 return rhs <= lhs;
580 }
582
583private:
585 template <size_t index>
586 constexpr rank_type to_component_rank() const noexcept
587 {
588 if constexpr (alphabet_size < 1024) // computation is cached for small alphabets
589 {
590 return rank_to_component_rank[index][to_rank()];
591 }
592 else
593 {
594 return (to_rank() / cummulative_alph_sizes[index]) %
595 seqan3::alphabet_size<pack_traits::at<index, component_types...>>;
596 }
597 }
598
600 template <size_t index>
601 constexpr void assign_component_rank(ptrdiff_t const r) noexcept
602 {
603 assign_rank(static_cast<ptrdiff_t>(to_rank()) +
604 ((r - static_cast<ptrdiff_t>(to_component_rank<index>())) *
605 static_cast<ptrdiff_t>(cummulative_alph_sizes[index])));
606 }
607
610 {
611 [] () constexpr
612 {
613 // create array (1, |sigma1|, |sigma1|*|sigma2|, ... , |sigma1|*...*|sigmaN|)
615 ret[0] = 1;
616 size_t count = 1;
617 using reverse_list_t = decltype(seqan3::list_traits::detail::reverse(component_list{}));
618 seqan3::detail::for_each<reverse_list_t>([&] (auto alphabet_type_identity) constexpr
619 {
620 using alphabet_t = typename decltype(alphabet_type_identity)::type;
621 ret[count] = static_cast<rank_type>(seqan3::alphabet_size<alphabet_t> * ret[count - 1]);
622 ++count;
623 });
624
625 // reverse and strip one: (|sigma1|*...*|sigmaN-1|, ... |sigma1|*|sigma2|, |sigma1|, 1)
626 // reverse order guarantees that the first alphabet is the most significant rank contributer
627 // resulting in element-wise alphabetical ordering on comparison
629 for (size_t i = 0; i < component_list::size(); ++i)
630 ret2[i] = ret[component_list::size() - i - 1];
631
632 return ret2;
633 }()
634 };
635
637 template <std::size_t ...idx>
638 static constexpr rank_type rank_sum_helper(component_types ... components, std::index_sequence<idx...> const &) noexcept
639 {
640 return ((seqan3::to_rank(components) * cummulative_alph_sizes[idx]) + ...);
641 }
642
645 list_traits::size<component_list>> rank_to_component_rank
646 {
647 [] () constexpr
648 {
650 list_traits::size<component_list>> ret{};
651
652 if constexpr (alphabet_size < 1024)
653 {
654 std::array<size_t, alphabet_size> alph_sizes{ seqan3::alphabet_size<component_types>... };
655
656 for (size_t i = 0; i < list_traits::size<component_list>; ++i)
657 for (size_t j = 0; j < static_cast<size_t>(alphabet_size); ++j)
658 ret[i][j] = (j / cummulative_alph_sizes[i]) % alph_sizes[i];
659 }
660
661 return ret;
662 }()
663 };
664};
665
672template <typename derived_type, typename ...component_types>
674 requires (detail::writable_constexpr_semialphabet<component_types> && ...) &&
675 (std::regular<component_types> && ...)
677template <typename alphabet_type, size_t index>
678class alphabet_tuple_base<derived_type, component_types...>::component_proxy : public alphabet_proxy<component_proxy<alphabet_type, index>, alphabet_type>
679{
680private:
684 friend base_t;
685
688
690 constexpr void on_update() noexcept
691 {
692 parent->assign_component_rank<index>(this->to_rank());
693 }
694
695public:
696 //Import from base type:
697 using base_t::operator=;
698
703 component_proxy() = delete;
704 constexpr component_proxy(component_proxy const &) = default;
705 constexpr component_proxy(component_proxy &&) = default;
706 constexpr component_proxy & operator=(component_proxy const &) = default;
707 constexpr component_proxy & operator=(component_proxy &&) = default;
708 ~component_proxy() = default;
709
711 constexpr component_proxy(alphabet_type const l, alphabet_tuple_base & p) :
712 base_t{l}, parent{&p}
713 {}
714
715 // Does not inherit the base's constructor for alphabet_type so as not to cause ambiguity
717
727 friend constexpr bool operator==(derived_type const lhs, component_proxy const rhs) noexcept
728 {
729 return get<index>(lhs) == static_cast<alphabet_type>(rhs);
730 }
731
733 friend constexpr bool operator==(component_proxy<alphabet_type, index> const lhs, derived_type const rhs) noexcept
734 {
735 return rhs == lhs;
736 }
737
739 friend constexpr bool operator!=(derived_type const lhs, component_proxy const rhs) noexcept
740 {
741 return get<index>(lhs) != static_cast<alphabet_type>(rhs);
742 }
743
745 friend constexpr bool operator!=(component_proxy<alphabet_type, index> const lhs, derived_type const rhs) noexcept
746 {
747 return rhs != lhs;
748 }
749
751 friend constexpr bool operator<(derived_type const lhs, component_proxy const rhs) noexcept
752 {
753 return get<index>(lhs) < static_cast<alphabet_type>(rhs);
754 }
755
757 friend constexpr bool operator<(component_proxy<alphabet_type, index> const lhs, derived_type const rhs) noexcept
758 {
759 return rhs > lhs;
760 }
761
763 friend constexpr bool operator<=(derived_type const lhs, component_proxy const rhs) noexcept
764 {
765 return get<index>(lhs) <= static_cast<alphabet_type>(rhs);
766 }
767
769 friend constexpr bool operator<=(component_proxy<alphabet_type, index> const lhs, derived_type const rhs) noexcept
770 {
771 return rhs >= lhs;
772 }
773
775 friend constexpr bool operator>(derived_type const lhs, component_proxy const rhs) noexcept
776 {
777 return get<index>(lhs) > static_cast<alphabet_type>(rhs);
778 }
779
781 friend constexpr bool operator>(component_proxy<alphabet_type, index> const lhs, derived_type const rhs) noexcept
782 {
783 return rhs < lhs;
784 }
785
787 friend constexpr bool operator>=(derived_type const lhs, component_proxy const rhs) noexcept
788 {
789 return get<index>(lhs) >= static_cast<alphabet_type>(rhs);
790 }
791
793 friend constexpr bool operator>=(component_proxy<alphabet_type, index> const lhs, derived_type const rhs) noexcept
794 {
795 return rhs <= lhs;
796 }
798};
799
800} // namespace seqan3
801
802namespace std
803{
804
812template <std::size_t i, seqan3::detail::alphabet_tuple_like tuple_t>
813struct tuple_element<i, tuple_t>
814{
817};
818
826template <seqan3::detail::alphabet_tuple_like tuple_t>
827struct tuple_size<tuple_t> :
828 public std::integral_constant<size_t, seqan3::list_traits::size<typename tuple_t::seqan3_required_types>>
829{};
830
831} // namespace std
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:57
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:203
constexpr rank_type to_rank() const noexcept
Return the letter's numeric value (rank in the alphabet).
Definition: alphabet_base.hpp:139
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:80
constexpr derived_type & assign_rank(rank_type const c) noexcept
Assign from a numeric value.
Definition: alphabet_base.hpp:191
A CRTP-base that eases the definition of proxy types returned in place of regular alphabets.
Definition: alphabet_proxy.hpp:67
Specialisation of seqan3::alphabet_proxy that updates the rank of the alphabet_tuple_base.
Definition: alphabet_tuple_base.hpp:679
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:745
constexpr void on_update() noexcept
The implementation updates the rank in the parent object.
Definition: alphabet_tuple_base.hpp:690
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:763
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:769
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:751
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:787
alphabet_tuple_base * parent
Store a pointer to the parent object so we can update it.
Definition: alphabet_tuple_base.hpp:687
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:727
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:757
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:711
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:739
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:781
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:733
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:775
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:793
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:684
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:123
~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:362
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:465
constexpr rank_type to_component_rank() const noexcept
Return the rank of the i-th component.
Definition: alphabet_tuple_base.hpp:586
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:638
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:562
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:531
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:496
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:553
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:238
static constexpr bool seqan3_alphabet_tuple_like
Make specialisations of this template identifiable in metapgrogramming contexts.
Definition: alphabet_tuple_base.hpp:182
constexpr alphabet_tuple_base(alphabet_tuple_base const &)=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:540
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:139
constexpr alphabet_tuple_base() noexcept
Defaulted.
Definition: alphabet_tuple_base.hpp:148
constexpr alphabet_tuple_base(component_types ... components) noexcept
Construction from initialiser-list.
Definition: alphabet_tuple_base.hpp:192
seqan3::type_list< component_types... > component_list
A seqan3::type_list The types of each component in the composite.
Definition: alphabet_tuple_base.hpp:131
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:509
friend constexpr type get(alphabet_tuple_base const &l) noexcept
Tuple-like access to the contained components.
Definition: alphabet_tuple_base.hpp:412
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:575
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:179
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:474
static constexpr std::array< rank_type, component_list::size()> cummulative_alph_sizes
The cumulative alphabet size products are cached.
Definition: alphabet_tuple_base.hpp:610
static constexpr bool is_component
Is set to true if the type is contained in the type list.
Definition: alphabet_tuple_base.hpp:135
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:601
constexpr alphabet_tuple_base(component_type const alph) noexcept
Construction via a value of one of the components.
Definition: alphabet_tuple_base.hpp:212
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:487
friend derived_type
Befriend the derived type so that it can instantiate.
Definition: alphabet_tuple_base.hpp:160
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:452
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:518
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:396
constexpr auto alphabet_size
A type trait that holds the size of a (semi-)alphabet.
Definition: concept.hpp:845
constexpr auto assign_rank_to
Assign a rank to an alphabet object.
Definition: concept.hpp:293
constexpr auto to_rank
Return the rank representation of a (semi-)alphabet object.
Definition: concept.hpp:154
decltype(detail::concat(lists_t{}...)) concat
Join two seqan3::type_list s into one.
Definition: traits.hpp:353
constexpr bool contains
Whether a type occurs in a type list or not.
Definition: traits.hpp:255
typename decltype(detail::at< idx >(list_t{}))::type at
Return the type at given index from the type list.
Definition: traits.hpp:284
constexpr ptrdiff_t count
Count the occurrences of a type in a pack.
Definition: traits.hpp:169
typename decltype(detail::at< idx, pack_t... >())::type at
Return the type at given index from the type pack.
Definition: traits.hpp:256
constexpr ptrdiff_t find_if
Get the index of the first type in a pack that satisfies the given predicate.
Definition: traits.hpp:210
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:51
Provides metaprogramming utilities for integer types.
Subconcept definition for seqan3::tuple_like to test for std::tuple_size-interface.
T invoke(T... args)
The internal SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
constexpr bool tuple_general_guard
Prevents wrong instantiations of seqan3::alphabet_tuple_base's equality comparison operators.
Definition: alphabet_tuple_base.hpp:36
constexpr bool tuple_eq_guard
Prevents wrong instantiations of seqan3::alphabet_tuple_base's equality comparison operators.
Definition: alphabet_tuple_base.hpp:46
constexpr bool tuple_order_guard
Prevents wrong instantiations of seqan3::alphabet_tuple_base's ordered comparison operators.
Definition: alphabet_tuple_base.hpp:54
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
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:429
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: detail.hpp:164
'Callable' helper class that is invokable by meta::invoke.Returns a std::true_type if the T is implic...
Definition: detail.hpp:152
'Callable' helper class that is invokable by meta::invoke.Returns a std::true_type if the type is wea...
Definition: detail.hpp:176
'Callable' helper class that is invokable by meta::invoke.Returns a std::true_type if the type is com...
Definition: detail.hpp:188
Type that contains multiple types.
Definition: type_list.hpp:29
static constexpr size_t size() noexcept
The number of types contained in the type list.
Definition: type_list.hpp:34
seqan3::list_traits::at< i, typename tuple_t::seqan3_required_types > type
Element type.
Definition: alphabet_tuple_base.hpp:816
Provides seqan3::detail::transformation_trait_or.
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.