19namespace seqan3::detail
40template <std::copy_constructible value_t>
41class repeat_view :
public std::ranges::view_interface<repeat_view<value_t>>
45 using base_t = std::ranges::view_interface<repeat_view<value_t>>;
48 using sentinel_type = std::default_sentinel_t;
51 using single_value_t =
decltype(std::views::single(std::declval<value_t>()));
60 using reference = value_type &;
62 using const_reference = value_type
const &;
64 using difference_type = ptrdiff_t;
68 template <
typename parent_type>
75 using iterator = basic_iterator<repeat_view>;
77 using const_iterator = basic_iterator<repeat_view const>;
81 template <
typename range_type,
template <
typename...>
typename derived_t_template,
typename... args_t>
82 friend class detail::random_access_iterator_base;
88 repeat_view() =
default;
89 repeat_view(repeat_view
const &) =
default;
90 repeat_view & operator=(repeat_view
const &) =
default;
91 repeat_view(repeat_view &&) =
default;
92 repeat_view & operator=(repeat_view &&) =
default;
93 ~repeat_view() =
default;
96 constexpr explicit repeat_view(value_t
const & value) : single_value{value}
100 constexpr explicit repeat_view(value_t && value) : single_value{
std::
move(value)}
122 constexpr iterator
begin() noexcept
124 return iterator{*
this};
128 constexpr const_iterator
begin() const noexcept
130 return const_iterator{*
this};
148 constexpr sentinel_type
end() noexcept
154 constexpr sentinel_type
end() const noexcept
179 constexpr const_reference operator[](difference_type
const SEQAN3_DOXYGEN_ONLY(n))
const noexcept
181 return *single_value.begin();
185 constexpr reference operator[](difference_type
const SEQAN3_DOXYGEN_ONLY(n))
noexcept
187 return *single_value.begin();
193 single_value_t single_value;
197template <std::copy_constructible value_t>
198template <
typename parent_type>
199class repeat_view<value_t>::basic_iterator :
public detail::random_access_iterator_base<parent_type, basic_iterator>
202 using base_t = detail::random_access_iterator_base<parent_type, basic_iterator>;
205 using typename base_t::position_type;
209 using typename base_t::difference_type;
211 using typename base_t::value_type;
213 using typename base_t::reference;
215 using typename base_t::pointer;
217 using typename base_t::iterator_category;
222 basic_iterator() =
default;
223 basic_iterator(basic_iterator
const &) =
default;
224 basic_iterator & operator=(basic_iterator
const &) =
default;
225 basic_iterator(basic_iterator &&) =
default;
226 basic_iterator & operator=(basic_iterator &&) =
default;
227 ~basic_iterator() =
default;
232 explicit constexpr basic_iterator(parent_type & host) noexcept : base_t{host}
238 template <
typename parent_type2>
239 requires std::is_const_v<parent_type> && (!std::is_const_v<parent_type2>)
241 constexpr basic_iterator(basic_iterator<parent_type2>
const & rhs) noexcept : base_t{rhs}
248 constexpr bool operator==(basic_iterator
const & rhs)
const noexcept
250 return base_t::operator==(rhs);
253 constexpr bool operator!=(basic_iterator
const & rhs)
const noexcept
255 return !(*
this == rhs);
259 constexpr bool operator==(std::default_sentinel_t
const &)
const noexcept
265 constexpr bool operator!=(std::default_sentinel_t
const &)
const noexcept
271 friend constexpr bool operator==(std::default_sentinel_t
const &, basic_iterator
const &)
noexcept
277 friend constexpr bool operator!=(std::default_sentinel_t
const &, basic_iterator
const &)
noexcept
292 template <std::copy_constructible value_type>
293 constexpr auto operator()(value_type && value)
const
295 return detail::repeat_view{std::forward<value_type>(value)};
344inline constexpr detail::repeat_fn
repeat{};
Provides various transformation traits used by the range module.
constexpr detail::repeat_fn repeat
A view factory that repeats a given value infinitely.
Definition repeat.hpp:344
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.
Provides the seqan3::detail::random_access_iterator class.