38template <std::ranges::view urng_t>
44 template <
typename underlying_iter_t>
63 template <
typename viewable_rng_t>
65 && std::ranges::viewable_range<viewable_rng_t>
82 constexpr auto begin() const noexcept
96 constexpr auto end() noexcept
98 if constexpr (std::ranges::common_range<urng_t>)
105 constexpr auto end() const noexcept
108 if constexpr (std::ranges::common_range<urng_t>)
111 return std::ranges::cend(
urng);
126template <std::ranges::view urng_t>
128template <
typename underlying_iter_t>
146 using base_t::base_t;
166 using base_t::operator==;
167 using base_t::operator!=;
170 noexcept(std::declval<underlying_iter_t const &>() == std::declval<std::ranges::sentinel_t<urng_t>
const &>()))
172 return lhs.base() == rhs;
177 noexcept(std::declval<underlying_iter_t const &>() == std::declval<std::ranges::sentinel_t<urng_t>
const &>()))
184 noexcept(std::declval<underlying_iter_t const &>() != std::declval<std::ranges::sentinel_t<urng_t>
const &>()))
186 return !(lhs == rhs);
191 noexcept(std::declval<underlying_iter_t const &>() != std::declval<std::ranges::sentinel_t<urng_t>
const &>()))
201 using base_t::operator-;
205 noexcept(
noexcept(std::declval<underlying_iter_t const &>()
206 - std::declval<std::ranges::sentinel_t<urng_t>
const &>()))
207 requires std::sized_sentinel_for<std::ranges::sentinel_t<urng_t>, underlying_iter_t>
209 return this->base() - rhs;
213 constexpr friend typename base_t::difference_type
215 basic_iterator const & rhs)
noexcept(
noexcept(std::declval<std::ranges::sentinel_t<urng_t>
const &>()
216 - std::declval<underlying_iter_t const &>()))
217 requires std::sized_sentinel_for<std::ranges::sentinel_t<urng_t>, underlying_iter_t>
219 return lhs - rhs.
base();
229template <std::ranges::viewable_range rng_t>
246 using base_t::base_t;
255 template <std::ranges::viewable_range urng_t>
256 static constexpr auto impl(urng_t && urange)
259 "The adapted range must either model std::ranges::random_access_range or must be "
260 "a specific SeqAn range type that supports pseudo random access.");
261 static_assert(std::ranges::forward_range<urng_t>,
262 "The underlying range must model std::ranges::forward_range.");
264 if constexpr (std::ranges::random_access_range<urng_t>)
266 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:74
A CRTP base template for creating iterators that inherit from other iterators.
Definition inherited_iterator_base.hpp:49
constexpr base_t const & base() const &noexcept
Get a const reference to the base.
Definition inherited_iterator_base.hpp:106
Iterator wrapper for the underlying range iterator enforcing std::random_access_iterator_tag.
Definition enforce_random_access.hpp:131
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:183
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:214
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:169
~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:190
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:176
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:204
View to force random access range iterator for seqan3::pseudo_random_access_range.
Definition enforce_random_access.hpp:41
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:96
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:105
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:67
urng_t urng
The underlying range.
Definition enforce_random_access.hpp:115
constexpr auto begin() const noexcept
Returns the iterator to the begin of the range.
Definition enforce_random_access.hpp:82
~view_enforce_random_access()=default
Defaulted.
constexpr view_enforce_random_access(urng_t &&range)
Construction from the underlying view.
Definition enforce_random_access.hpp:59
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:76
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:347
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:26
The SeqAn namespace for views.
Definition char_strictly_to.hpp:19
SeqAn specific customisations in the standard namespace.
View adaptor definition for seqan3::views::enforce_random_access.
Definition enforce_random_access.hpp:239
static constexpr auto impl(urng_t &&urange)
Call the view's constructor with the underlying view as argument.
Definition enforce_random_access.hpp:256
friend base_t
Befriend the base class so it can call impl().
Definition enforce_random_access.hpp:250
Additional non-standard concepts for ranges.