41template <std::ranges::view urng_t>
47 template <
typename underlying_iter_t>
66 template <
typename viewable_rng_t>
68 && std::ranges::viewable_range<viewable_rng_t>
85 constexpr auto begin() const noexcept
99 constexpr auto end() noexcept
101 if constexpr (std::ranges::common_range<urng_t>)
108 constexpr auto end() const noexcept
111 if constexpr (std::ranges::common_range<urng_t>)
114 return std::ranges::cend(
urng);
129template <std::ranges::view urng_t>
131template <
typename underlying_iter_t>
149 using base_t::base_t;
169 using base_t::operator==;
170 using base_t::operator!=;
173 noexcept(std::declval<underlying_iter_t const &>() == std::declval<std::ranges::sentinel_t<urng_t>
const &>()))
175 return lhs.base() == rhs;
180 noexcept(std::declval<underlying_iter_t const &>() == std::declval<std::ranges::sentinel_t<urng_t>
const &>()))
187 noexcept(std::declval<underlying_iter_t const &>() != std::declval<std::ranges::sentinel_t<urng_t>
const &>()))
189 return !(lhs == rhs);
194 noexcept(std::declval<underlying_iter_t const &>() != std::declval<std::ranges::sentinel_t<urng_t>
const &>()))
204 using base_t::operator-;
208 noexcept(
noexcept(std::declval<underlying_iter_t const &>()
209 - std::declval<std::ranges::sentinel_t<urng_t>
const &>()))
210 requires std::sized_sentinel_for<std::ranges::sentinel_t<urng_t>, underlying_iter_t>
212 return this->base() - rhs;
216 constexpr friend typename base_t::difference_type
218 basic_iterator const & rhs)
noexcept(
noexcept(std::declval<std::ranges::sentinel_t<urng_t>
const &>()
219 - std::declval<underlying_iter_t const &>()))
220 requires std::sized_sentinel_for<std::ranges::sentinel_t<urng_t>, underlying_iter_t>
222 return lhs - rhs.
base();
232template <std::ranges::viewable_range rng_t>
249 using base_t::base_t;
258 template <std::ranges::viewable_range urng_t>
259 static constexpr auto impl(urng_t && urange)
262 "The adapted range must either model std::ranges::random_access_range or must be "
263 "a specific SeqAn range type that supports pseudo random access.");
264 static_assert(std::ranges::forward_range<urng_t>,
265 "The underlying range must model std::ranges::forward_range.");
267 if constexpr (std::ranges::random_access_range<urng_t>)
269 return std::views::all(std::forward<urng_t>(urange));
Provides seqan3::detail::adaptor_base and seqan3::detail::combined_adaptor.
CRTP-base to simplify the definition of range adaptor closure objects and similar types.
Definition: adaptor_base.hpp:77
A CRTP base template for creating iterators that inherit from other iterators.
Definition: inherited_iterator_base.hpp:52
constexpr base_t const & base() const &noexcept
Get a const reference to the base.
Definition: inherited_iterator_base.hpp:109
Iterator wrapper for the underlying range iterator enforcing std::random_access_iterator_tag.
Definition: enforce_random_access.hpp:134
friend constexpr bool operator!=(basic_iterator const &lhs, std::ranges::sentinel_t< urng_t > const &rhs) noexcept(noexcept(std::declval< underlying_iter_t const & >() !=std::declval< std::ranges::sentinel_t< urng_t > const & >()))
Tests if iterator is not at the end.
Definition: enforce_random_access.hpp:186
constexpr basic_iterator & operator=(basic_iterator &&)=default
Defaulted.
constexpr basic_iterator(basic_iterator const &)=default
Defaulted.
constexpr basic_iterator(basic_iterator &&)=default
Defaulted.
constexpr friend base_t::difference_type operator-(std::ranges::sentinel_t< urng_t > const &lhs, basic_iterator const &rhs) noexcept(noexcept(std::declval< std::ranges::sentinel_t< urng_t > const & >() - std::declval< underlying_iter_t const & >()))
Computes the distance betwen this iterator and the sentinel of the underlying range.
Definition: enforce_random_access.hpp:217
constexpr basic_iterator()=default
Defaulted.
friend constexpr bool operator==(basic_iterator const &lhs, std::ranges::sentinel_t< urng_t > const &rhs) noexcept(noexcept(std::declval< underlying_iter_t const & >()==std::declval< std::ranges::sentinel_t< urng_t > const & >()))
Tests if iterator is at the end.
Definition: enforce_random_access.hpp:172
~basic_iterator()=default
Defaulted.
constexpr basic_iterator & operator=(basic_iterator const &)=default
Defaulted.
friend constexpr bool operator!=(std::ranges::sentinel_t< urng_t > const &lhs, basic_iterator const &rhs) noexcept(noexcept(std::declval< underlying_iter_t const & >() !=std::declval< std::ranges::sentinel_t< urng_t > const & >()))
Tests if iterator is not at the end.
Definition: enforce_random_access.hpp:193
friend constexpr bool operator==(std::ranges::sentinel_t< urng_t > const &lhs, basic_iterator const &rhs) noexcept(noexcept(std::declval< underlying_iter_t const & >()==std::declval< std::ranges::sentinel_t< urng_t > const & >()))
Tests if iterator is at the end.
Definition: enforce_random_access.hpp:179
constexpr base_t::difference_type operator-(std::ranges::sentinel_t< urng_t > const &rhs) const noexcept(noexcept(std::declval< underlying_iter_t const & >() - std::declval< std::ranges::sentinel_t< urng_t > const & >()))
Computes the distance betwen this iterator and the sentinel of the underlying range.
Definition: enforce_random_access.hpp:207
View to force random access range iterator for seqan3::pseudo_random_access_range.
Definition: enforce_random_access.hpp:44
constexpr view_enforce_random_access & operator=(view_enforce_random_access const &)=default
Defaulted.
constexpr auto end() noexcept
Returns the sentinel to the end of the range.
Definition: enforce_random_access.hpp:99
view_enforce_random_access(rng_t &&) -> view_enforce_random_access< std::views::all_t< rng_t > >
A deduction guide for the view class template.
constexpr view_enforce_random_access(view_enforce_random_access &&)=default
Defaulted.
constexpr auto end() const noexcept
Returns the sentinel to the end of the range.
Definition: enforce_random_access.hpp:108
constexpr view_enforce_random_access()=default
Defaulted.
constexpr view_enforce_random_access(viewable_rng_t &&range)
Construction from the underlying viewable range.
Definition: enforce_random_access.hpp:70
urng_t urng
The underlying range.
Definition: enforce_random_access.hpp:118
constexpr auto begin() const noexcept
Returns the iterator to the begin of the range.
Definition: enforce_random_access.hpp:85
~view_enforce_random_access()=default
Defaulted.
constexpr view_enforce_random_access(urng_t &&range)
Construction from the underlying view.
Definition: enforce_random_access.hpp:62
constexpr view_enforce_random_access & operator=(view_enforce_random_access &&)=default
Defaulted.
constexpr auto begin() noexcept
Returns the iterator to the begin of the range.
Definition: enforce_random_access.hpp:79
constexpr view_enforce_random_access(view_enforce_random_access const &)=default
Defaulted.
constexpr auto enforce_random_access
A view adaptor that converts a pseudo random access range to a std::ranges::random_access_range.
Definition: enforce_random_access.hpp:350
Provides the seqan3::detail::inherited_iterator_base template.
Specifies requirements of an input range type for which the const version of that type satisfies the ...
This concept checks if a type models a pseudo random access range.
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.
View adaptor definition for seqan3::views::enforce_random_access.
Definition: enforce_random_access.hpp:242
static constexpr auto impl(urng_t &&urange)
Call the view's constructor with the underlying view as argument.
Definition: enforce_random_access.hpp:259
friend base_t
Befriend the base class so it can call impl().
Definition: enforce_random_access.hpp:253
Additional non-standard concepts for ranges.