41template <std::ranges::view underlying_range_type>
42 requires std::ranges::forward_range<underlying_range_type> && std::ranges::common_range<underlying_range_type>
47 template <
typename range_type>
91 if (std::ranges::empty(
u_range))
97 if constexpr (std::ranges::bidirectional_range<underlying_range_type>)
104 if constexpr (std::ranges::sized_range<underlying_range_type>)
115 while (++tmp_it != std::ranges::end(
u_range));
140 template <
typename other_range_t>
142 && std::ranges::viewable_range<other_range_t>
144 std::constructible_from<underlying_range_type,
211 constexpr auto size() const noexcept
212 requires
std::ranges::sized_range<underlying_range_type>
231template <std::ranges::viewable_range other_range_t>
248template <std::ranges::view underlying_range_type>
249 requires std::ranges::forward_range<underlying_range_type> && std::ranges::common_range<underlying_range_type>
250template <
typename range_type>
256 template <
typename other_range_type>
310 second_it{std::ranges::next(iter, 1, end_it)},
323 template <
typename other_range_type>
324 requires std::convertible_to<other_range_type, range_type &>
327 basic_iterator{std::move(other.first_it), std::move(other.begin_it), std::move(other.end_it)}
344 noexcept(
noexcept(std::declval<basic_iterator &>().from_index(1)))
345 requires std::random_access_iterator<underlying_iterator_type>
347 return *(*
this + index);
358 if (++second_it == end_it)
361 second_it = first_it;
369 operator++(
int )
noexcept(
noexcept(std::declval<underlying_iterator_type &>()++))
381 if (--second_it == first_it)
392 operator--(
int )
noexcept(
noexcept(std::declval<underlying_iterator_type &>()--))
393 requires std::bidirectional_iterator<underlying_iterator_type>
404 requires std::random_access_iterator<underlying_iterator_type>
406 from_index(to_index() +
offset);
413 noexcept(
noexcept(std::declval<basic_iterator &>() += 1))
414 requires std::random_access_iterator<underlying_iterator_type>
424 basic_iterator iter)
noexcept(
noexcept(std::declval<basic_iterator<range_type> &>().from_index(1)))
425 requires std::random_access_iterator<underlying_iterator_type>
435 requires std::random_access_iterator<underlying_iterator_type>
437 from_index(to_index() -
offset);
444 noexcept(
noexcept(std::declval<basic_iterator &>() -= 1))
445 requires std::random_access_iterator<underlying_iterator_type>
453 template <
typename other_range_type>
454 requires std::random_access_iterator<underlying_iterator_type>
457 noexcept(
noexcept(std::declval<basic_iterator &>().to_index()))
473 template <
typename other_range_type>
474 requires std::equality_comparable_with<underlying_iterator_type, std::ranges::iterator_t<other_range_type>>
477 noexcept(
noexcept(std::declval<underlying_iterator_type &>() == std::declval<underlying_iterator_type &>()))
479 return std::tie(first_it, second_it) ==
std::tie(rhs.first_it, rhs.second_it);
483 template <
typename other_range_type>
484 requires std::equality_comparable_with<underlying_iterator_type, std::ranges::iterator_t<other_range_type>>
487 noexcept(
noexcept(std::declval<underlying_iterator_type &>() != std::declval<underlying_iterator_type &>()))
489 return !(*
this == rhs);
493 template <
typename other_range_type>
494 requires std::totally_ordered_with<underlying_iterator_type, std::ranges::iterator_t<other_range_type>>
497 noexcept(
noexcept(std::declval<underlying_iterator_type &>() < std::declval<underlying_iterator_type &>()))
499 return std::tie(first_it, second_it) <
std::tie(rhs.first_it, rhs.second_it);
503 template <
typename other_range_type>
504 requires std::totally_ordered_with<underlying_iterator_type, std::ranges::iterator_t<other_range_type>>
507 noexcept(
noexcept(std::declval<underlying_iterator_type &>() > std::declval<underlying_iterator_type &>()))
510 return std::tie(first_it, second_it) >
std::tie(rhs.first_it, rhs.second_it);
514 template <
typename other_range_type>
515 requires std::totally_ordered_with<underlying_iterator_type, std::ranges::iterator_t<other_range_type>>
518 noexcept(
noexcept(std::declval<underlying_iterator_type &>() <= std::declval<underlying_iterator_type &>()))
520 return std::tie(first_it, second_it) <=
std::tie(rhs.first_it, rhs.second_it);
524 template <
typename other_range_type>
525 requires std::totally_ordered_with<underlying_iterator_type, std::ranges::iterator_t<other_range_type>>
528 noexcept(
noexcept(std::declval<underlying_iterator_type &>() >= std::declval<underlying_iterator_type &>()))
530 return std::tie(first_it, second_it) >=
std::tie(rhs.first_it, rhs.second_it);
551 size_t src_size = end_it - begin_it;
552 size_t index_i = first_it - begin_it;
553 size_t index_j = second_it - begin_it;
554 return (src_size * (src_size - 1) / 2) - (src_size - index_i) * ((src_size - index_i) - 1) / 2 + index_j
562 constexpr void from_index(
size_t const index)
noexcept(
noexcept(
563 std::declval<underlying_iterator_type &>()
564 - std::declval<underlying_iterator_type &>()) &&
noexcept(std::declval<underlying_iterator_type &>() + 1))
565 requires std::random_access_iterator<underlying_iterator_type>
567 size_t src_size = end_it - begin_it;
569 src_size - 2 -
std::floor(
std::sqrt(-8 * index + 4 * src_size * (src_size - 1) - 7) / 2.0 - 0.5);
571 index + index_i + 1 - src_size * (src_size - 1) / 2 + (src_size - index_i) * ((src_size - index_i) - 1) / 2;
572 first_it = begin_it + index_i;
573 second_it = begin_it + index_j;
Provides seqan3::detail::adaptor_for_view_without_args.
A std::tuple implementation that incorporates most changes from C++23's standard library.
Definition: common_tuple.hpp:29
Template for range adaptor closure objects that store no arguments and always delegate to the view co...
Definition: adaptor_for_view_without_args.hpp:49
The forward declared iterator type for pairwise_combine_view.
Definition: pairwise_combine.hpp:253
constexpr basic_iterator operator++(int) noexcept(noexcept(std::declval< underlying_iterator_type & >()++))
Post-increment operator.
Definition: pairwise_combine.hpp:369
constexpr void from_index(size_t const index) noexcept(noexcept(std::declval< underlying_iterator_type & >() - std::declval< underlying_iterator_type & >()) &&noexcept(std::declval< underlying_iterator_type & >()+1))
Sets the iterator to the given index.
Definition: pairwise_combine.hpp:562
constexpr basic_iterator & operator-=(difference_type const offset) noexcept(noexcept(std::declval< basic_iterator & >().from_index(1)))
Decrements the iterator by the given offset; underlying_iterator_type must model \ std::random_access...
Definition: pairwise_combine.hpp:434
constexpr basic_iterator & operator+=(difference_type const offset) noexcept(noexcept(std::declval< basic_iterator & >().from_index(1)))
Advances the iterator by the given offset; underlying_iterator_type must model \ std::random_access_i...
Definition: pairwise_combine.hpp:403
constexpr reference operator[](size_t const index) const noexcept(noexcept(std::declval< basic_iterator & >().from_index(1)))
Access the element at the given index.
Definition: pairwise_combine.hpp:343
constexpr reference operator*() const noexcept(noexcept(*std::declval< underlying_iterator_type >()))
Accesses the pointed-to element.
Definition: pairwise_combine.hpp:335
constexpr bool operator!=(basic_iterator< other_range_type > const &rhs) const noexcept(noexcept(std::declval< underlying_iterator_type & >() !=std::declval< underlying_iterator_type & >()))
Checks whether *this is not equal to rhs.
Definition: pairwise_combine.hpp:486
basic_iterator(basic_iterator const &)=default
Defaulted.
constexpr size_t to_index() const noexcept(noexcept(std::declval< underlying_iterator_type & >() - std::declval< underlying_iterator_type & >()))
Returns the index for the current iterator position.
Definition: pairwise_combine.hpp:547
constexpr difference_type operator-(basic_iterator< other_range_type > const &rhs) const noexcept(noexcept(std::declval< basic_iterator & >().to_index()))
Computes the distance between two iterators; underlying_iterator_type must model \ std::random_access...
Definition: pairwise_combine.hpp:456
basic_iterator()=default
Defaulted.
basic_iterator & operator=(basic_iterator const &)=default
Defaulted.
constexpr bool operator==(basic_iterator< other_range_type > const &rhs) const noexcept(noexcept(std::declval< underlying_iterator_type & >()==std::declval< underlying_iterator_type & >()))
Checks whether *this is equal to rhs.
Definition: pairwise_combine.hpp:476
constexpr friend basic_iterator operator+(difference_type const offset, basic_iterator iter) noexcept(noexcept(std::declval< basic_iterator< range_type > & >().from_index(1)))
Advances the iterator by the given offset; underlying_iterator_type must model \ std::random_access_i...
Definition: pairwise_combine.hpp:423
constexpr basic_iterator & operator++() noexcept(noexcept(++std::declval< underlying_iterator_type & >()))
Pre-increment operator.
Definition: pairwise_combine.hpp:356
void pointer
The pointer type.
Definition: pairwise_combine.hpp:279
constexpr bool operator<=(basic_iterator< other_range_type > const &rhs) const noexcept(noexcept(std::declval< underlying_iterator_type & >()<=std::declval< underlying_iterator_type & >()))
Checks whether *this is less than or equal to rhs.
Definition: pairwise_combine.hpp:517
constexpr basic_iterator(underlying_iterator_type iter, underlying_iterator_type begin_it, underlying_iterator_type end_it) noexcept
Constructs the iterator from the current underlying iterator and the end iterator of the underlying r...
Definition: pairwise_combine.hpp:306
constexpr basic_iterator operator+(difference_type const offset) const noexcept(noexcept(std::declval< basic_iterator & >()+=1))
Advances the iterator by the given offset; underlying_iterator_type must model \ std::random_access_i...
Definition: pairwise_combine.hpp:412
constexpr basic_iterator(basic_iterator< other_range_type > other) noexcept
Constructs const iterator from non-const iterator.
Definition: pairwise_combine.hpp:326
constexpr bool operator<(basic_iterator< other_range_type > const &rhs) const noexcept(noexcept(std::declval< underlying_iterator_type & >()< std::declval< underlying_iterator_type & >()))
Checks whether *this is less than rhs.
Definition: pairwise_combine.hpp:496
std::ranges::iterator_t< range_type > underlying_iterator_type
Alias type for the iterator over the passed range type.
Definition: pairwise_combine.hpp:261
constexpr basic_iterator operator-(difference_type const offset) const noexcept(noexcept(std::declval< basic_iterator & >() -=1))
Decrements the iterator by the given offset; underlying_iterator_type must model \ std::random_access...
Definition: pairwise_combine.hpp:443
constexpr bool operator>=(basic_iterator< other_range_type > const &rhs) const noexcept(noexcept(std::declval< underlying_iterator_type & >() >=std::declval< underlying_iterator_type & >()))
Checks whether *this is greater than or equal to rhs.
Definition: pairwise_combine.hpp:527
~basic_iterator()=default
Defaulted.
basic_iterator & operator=(basic_iterator &&)=default
Defaulted.
constexpr basic_iterator operator--(int) noexcept(noexcept(std::declval< underlying_iterator_type & >() --))
Post-decrement operator; underlying_iterator_type must model std::bidirectional_iterator.
Definition: pairwise_combine.hpp:392
basic_iterator(basic_iterator &&)=default
Defaulted.
constexpr basic_iterator & operator--() noexcept(noexcept(--std::declval< underlying_iterator_type & >()))
Pre-decrement operator; underlying_iterator_type must model std::bidirectional_iterator.
Definition: pairwise_combine.hpp:378
constexpr bool operator>(basic_iterator< other_range_type > const &rhs) const noexcept(noexcept(std::declval< underlying_iterator_type & >() > std::declval< underlying_iterator_type & >()))
Checks whether *this is greater than rhs.
Definition: pairwise_combine.hpp:506
Generates all pairwise combinations of the elements in the underlying range.
Definition: pairwise_combine.hpp:44
underlying_range_type u_range
The underling range.
Definition: pairwise_combine.hpp:221
pairwise_combine_view(pairwise_combine_view const &)=default
Defaulted.
constexpr pairwise_combine_view(other_range_t &&range)
Constructs from a view.
Definition: pairwise_combine.hpp:149
pairwise_combine_view(pairwise_combine_view &&)=default
Defaulted.
constexpr pairwise_combine_view(underlying_range_type range)
Constructs from a view.
Definition: pairwise_combine.hpp:88
constexpr iterator begin() noexcept
Returns an iterator to the first element of the range.
Definition: pairwise_combine.hpp:169
pairwise_combine_view()=default
Defaulted.
constexpr auto size() const noexcept
Computes the size based on the size of the underlying range.
Definition: pairwise_combine.hpp:211
transformation_trait_or_t< std::type_identity< basic_iterator< underlying_range_type const > >, void > const_iterator
The const iterator type. Evaluates to void if the underlying range is not const iterable.
Definition: pairwise_combine.hpp:58
pairwise_combine_view & operator=(pairwise_combine_view &&)=default
Defaulted.
std::ranges::iterator_t< underlying_range_type > back_iterator
The cached iterator pointing to the last element of the underlying range.
Definition: pairwise_combine.hpp:223
~pairwise_combine_view()=default
Defaulted.
constexpr const_iterator end() const noexcept
Returns an iterator to the element following the last element of the range.
Definition: pairwise_combine.hpp:200
constexpr const_iterator begin() const noexcept
Returns an iterator to the first element of the range.
Definition: pairwise_combine.hpp:175
pairwise_combine_view & operator=(pairwise_combine_view const &)=default
Defaulted.
constexpr iterator end() noexcept
Returns an iterator to the element following the last element of the range.
Definition: pairwise_combine.hpp:194
A generic random access iterator that delegates most operations to the range.
Definition: random_access_iterator.hpp:294
Provides seqan3::common_tuple.
@ offset
Sequence (seqan3::field::seq) relative start position (0-based), unsigned value.
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
constexpr auto pairwise_combine
A view adaptor that generates all pairwise combinations of the elements of the underlying range.
Definition: pairwise_combine.hpp:652
Specifies requirements of an input range type for which the const version of that type satisfies the ...
Provides various transformation traits for use on iterators.
The internal SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
The SeqAn namespace for views.
Definition: char_strictly_to.hpp:22
SeqAn specific customisations in the standard namespace.
Defines iterator_category member if underlying_iterator_t has a valid std::iterator_traits::iterator_...
Definition: iterator_traits.hpp:42
Additional non-standard concepts for ranges.