39 template <std::ranges::view urng_t>
48 template <
typename underlying_iter_t>
68 template <
typename viewable_rng_t>
71 std::ranges::viewable_range<viewable_rng_t> &&
72 std::constructible_from<urng_t, std::ranges::ref_view<std::remove_reference_t<viewable_rng_t>>>
89 constexpr
auto begin() const noexcept
105 constexpr
auto end() noexcept
107 if constexpr (std::ranges::common_range<urng_t>)
114 constexpr
auto end() const noexcept
119 if constexpr (std::ranges::common_range<urng_t>)
122 return std::ranges::cend(
urng);
137 template <std::ranges::view urng_t>
141 template <
typename underlying_iter_t>
160 using base_t::base_t;
180 using base_t::operator==;
181 using base_t::operator!=;
184 noexcept(noexcept(std::declval<underlying_iter_t const &>() ==
185 std::declval<std::ranges::sentinel_t<urng_t>
const &>()))
187 return lhs.base() == rhs;
192 noexcept(noexcept(std::declval<underlying_iter_t const &>() ==
193 std::declval<std::ranges::sentinel_t<urng_t>
const &>()))
200 noexcept(noexcept(std::declval<underlying_iter_t const &>() !=
201 std::declval<std::ranges::sentinel_t<urng_t>
const &>()))
203 return !(lhs == rhs);
208 noexcept(noexcept(std::declval<underlying_iter_t const &>() !=
209 std::declval<std::ranges::sentinel_t<urng_t>
const &>()))
219 using base_t::operator-;
222 constexpr
typename base_t::difference_type operator-(std::ranges::sentinel_t<urng_t>
const & rhs)
const
223 noexcept(noexcept(std::declval<underlying_iter_t const &>() -
224 std::declval<std::ranges::sentinel_t<urng_t>
const &>()))
225 requires
std::sized_sentinel_for<
std::ranges::sentinel_t<urng_t>, underlying_iter_t>
227 return this->base() - rhs;
231 constexpr
friend typename base_t::difference_type operator-(std::ranges::sentinel_t<urng_t>
const & lhs,
233 noexcept(noexcept(
std::declval<std::ranges::sentinel_t<urng_t>
const &>() -
234 std::declval<underlying_iter_t const &>()))
235 requires
std::sized_sentinel_for<
std::ranges::sentinel_t<urng_t>, underlying_iter_t>
237 return lhs - rhs.base();
247 template <std::ranges::viewable_range rng_t>
264 using base_t::base_t;
273 template <std::ranges::viewable_range urng_t>
274 static constexpr
auto impl(urng_t && urange)
277 "The adapted range must either model std::ranges::random_access_range or must be "
278 "a specific SeqAn range type that supports pseudo random access.");
279 static_assert(std::ranges::forward_range<urng_t>,
280 "The underlying range must model std::ranges::forward_range.");
282 if constexpr (std::ranges::random_access_range<urng_t>)
284 return std::views::all(std::forward<urng_t>(urange));
CRTP-base to simplify the definition of range adaptor closure objects and similar types.
Definition: detail.hpp:79
Forward declaration.
Definition: single_pass_input.hpp:29
A CRTP base template for creating iterators that inherit from other iterators.
Definition: inherited_iterator_base.hpp:52
Iterator wrapper for the underlying range iterator enforcing std::random_access_iterator_tag.
Definition: enforce_random_access.hpp:144
constexpr basic_iterator & operator=(basic_iterator &&)=default
Defaulted.
constexpr basic_iterator & operator=(basic_iterator const &)=default
Defaulted.
constexpr basic_iterator(basic_iterator const &)=default
Defaulted.
constexpr friend 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:191
constexpr friend 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:207
constexpr basic_iterator(basic_iterator &&)=default
Defaulted.
constexpr basic_iterator()=default
Defaulted.
~basic_iterator()=default
Defaulted.
constexpr friend 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:199
constexpr friend 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:183
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 &&)=default
Defaulted.
constexpr auto begin() const noexcept
Returns the iterator to the begin of the range.
Definition: enforce_random_access.hpp:89
constexpr auto end() noexcept
Returns the sentinel to the end of the range.
Definition: enforce_random_access.hpp:105
constexpr view_enforce_random_access(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:74
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()=default
Defaulted.
urng_t urng
The underlying range.
Definition: enforce_random_access.hpp:126
constexpr auto end() const noexcept
Returns the sentinel to the end of the range.
Definition: enforce_random_access.hpp:114
~view_enforce_random_access()=default
Defaulted.
constexpr view_enforce_random_access & operator=(view_enforce_random_access const &)=default
Defaulted.
constexpr auto begin() noexcept
Returns the iterator to the begin of the range.
Definition: enforce_random_access.hpp:83
constexpr view_enforce_random_access(urng_t range)
Construction from the underlying view.
Definition: enforce_random_access.hpp:64
constexpr view_enforce_random_access(view_enforce_random_access const &)=default
Defaulted.
auto const move
A view that turns lvalue-references into rvalue-references.
Definition: move.hpp:70
constexpr auto enforce_random_access
A view adaptor that converts a pseudo random access range to a std::random_access_range.
Definition: enforce_random_access.hpp:368
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.
Provides C++20 additions to the <iterator> header.
The internal SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
The SeqAn namespace for views.
Definition: async_input_buffer.hpp:343
SeqAn specific customisations in the standard namespace.
Additional non-standard concepts for ranges.
Auxiliary header for the views submodule .
Adaptations of concepts from the Ranges TS.
View adaptor definition for seqan3::views::enforce_random_access.
Definition: enforce_random_access.hpp:257
static constexpr auto impl(urng_t &&urange)
Call the view's constructor with the underlying view as argument.
Definition: enforce_random_access.hpp:274
friend base_t
Befriend the base class so it can call impl().
Definition: enforce_random_access.hpp:268