26namespace seqan3::detail
30template <
typename view_t>
39template <std::ranges::view urng_t>
40class single_pass_input_view :
public std::ranges::view_interface<single_pass_input_view<urng_t>>
46 using urng_iterator_type = std::ranges::iterator_t<urng_t>;
49 template <
typename view_t>
50 friend class basic_iterator;
68 using iterator = basic_iterator<single_pass_input_view>;
70 using sentinel = std::ranges::sentinel_t<urng_t>;
79 constexpr single_pass_input_view() =
default;
81 constexpr single_pass_input_view(single_pass_input_view
const &) =
default;
83 constexpr single_pass_input_view(single_pass_input_view &&) =
default;
85 constexpr single_pass_input_view & operator=(single_pass_input_view
const &) =
default;
87 constexpr single_pass_input_view & operator=(single_pass_input_view &&) =
default;
89 ~single_pass_input_view() =
default;
92 explicit constexpr single_pass_input_view(urng_t _urng) : state_ptr{new state{
std::
move(_urng)}}
96 template <
typename other_urng_t>
97 requires (!std::same_as<std::remove_cvref_t<other_urng_t>, single_pass_input_view>
98 && std::ranges::viewable_range<other_urng_t>
100 std::constructible_from<urng_t, std::ranges::ref_view<std::remove_reference_t<other_urng_t>>>)
101 explicit constexpr single_pass_input_view(other_urng_t && _urng) : single_pass_input_view{std::views::all(_urng)}
121 iterator
begin()
const =
delete;
126 return {std::ranges::end(state_ptr->urng)};
130 sentinel
end()
const =
delete;
140template <std::ranges::viewable_range urng_t>
141single_pass_input_view(urng_t &&) -> single_pass_input_view<std::views::all_t<urng_t>>;
149namespace seqan3::detail
158template <
typename view_type>
159class basic_iterator<single_pass_input_view<view_type>>
162 using base_iterator_type =
typename single_pass_input_view<view_type>::urng_iterator_type;
164 using sentinel_type =
typename single_pass_input_view<view_type>::sentinel;
167 single_pass_input_view<view_type> * view_ptr{};
170 template <
typename input_view_type>
171 friend class basic_iterator;
174 static_assert(std::sentinel_for<sentinel_type, base_iterator_type>);
185 using pointer = detail::iter_pointer_t<base_iterator_type>;
196 basic_iterator() =
default;
198 constexpr basic_iterator(basic_iterator
const & rhs) =
default;
200 constexpr basic_iterator(basic_iterator && rhs) =
default;
202 constexpr basic_iterator & operator=(basic_iterator
const & rhs) =
default;
204 constexpr basic_iterator & operator=(basic_iterator && rhs) =
default;
206 ~basic_iterator() =
default;
209 basic_iterator(single_pass_input_view<view_type> & view) noexcept : view_ptr{&view}
217 reference operator*() const noexcept
223 pointer operator->() const noexcept
224 requires (!
std::is_void_v<pointer>)
234 basic_iterator & operator++() noexcept
241 void operator++(
int)
noexcept
255 constexpr bool operator==(sentinel_type
const & s)
const noexcept
257 return cached() == s;
261 friend constexpr bool operator==(sentinel_type
const & s, basic_iterator
const & rhs)
noexcept
267 constexpr bool operator!=(sentinel_type
const & rhs)
const noexcept
269 return !(*
this == rhs);
273 friend constexpr bool operator!=(sentinel_type
const & s, basic_iterator
const & rhs)
noexcept
282 base_iterator_type & cached() const noexcept
284 assert(view_ptr !=
nullptr);
285 assert(view_ptr->state_ptr !=
nullptr);
286 return view_ptr->state_ptr->cached_urng_iter;
345inline constexpr auto single_pass_input = detail::adaptor_for_view_without_args<detail::single_pass_input_view>{};
Provides seqan3::detail::adaptor_for_view_without_args.
Provides various transformation traits for use on iterators.
The SeqAn namespace for views.
Definition char_strictly_to.hpp:19
SeqAn specific customisations in the standard namespace.