17template<concepts::Movable T, concepts::Semiregular Bound = UnreachableSentinel>
18requires(concepts::Object<T> && concepts::SameAs<T, meta::RemoveCV<T>> &&
19 (concepts::Integer<Bound> || concepts::SameAs<Bound, UnreachableSentinel>) )
27 class Iterator :
public IteratorBase<Iterator, RandomAccessIteratorTag, T, SSizeType> {
29 constexpr Iterator() =
default;
31 constexpr explicit Iterator(T
const* value, IndexType current = IndexType())
32 : m_value(value), m_current(current) {}
34 constexpr auto operator*()
const -> T
const& {
return *m_value; }
36 constexpr void advance_one() { ++m_current; }
37 constexpr void back_one() { --m_current; }
38 constexpr void advance_n(SSizeType n) { m_current += n; }
41 constexpr friend auto operator==(Iterator
const& a, Iterator
const& b) ->
bool {
42 return a.m_current == b.m_current;
44 constexpr friend auto operator<=>(Iterator
const& a, Iterator
const& b) {
return a.m_current <=> b.m_current; }
46 constexpr friend auto operator-(Iterator
const& a, Iterator
const& b) -> SSizeType {
47 return static_cast<SSizeType
>(a.m_current) -
static_cast<SSizeType
>(b.m_current);
50 T
const* m_value {
nullptr };
51 IndexType m_current {};
59 constexpr explicit RepeatView(T
const& value, Bound bound = Bound())
61 : m_value(value), m_bound(bound) {}
63 constexpr explicit RepeatView(T&& value, Bound bound = Bound()) : m_value(
util::
move(value)), m_bound(bound) {}
65 constexpr auto begin() const -> Iterator {
return Iterator(util::addressof(m_value)); }
67 constexpr auto end() const -> Iterator {
return Iterator(util::addressof(m_value), m_bound); }
74 constexpr auto size() const
85template<
typename T,
typename Bound>
Definition repeat_view.h:20
constexpr RepeatView(T &&value, Bound bound=Bound())
Definition repeat_view.h:63
constexpr auto begin() const -> Iterator
Definition repeat_view.h:65
constexpr auto end() const -> UnreachableSentinel requires(!is_bounded)
Definition repeat_view.h:68
constexpr auto size() const
Definition repeat_view.h:74
constexpr RepeatView(T const &value, Bound bound=Bound())
Definition repeat_view.h:59
constexpr auto end() const -> Iterator
Definition repeat_view.h:67
constexpr RepeatView()=default
Definition view_interface.h:26
Definition operations.h:34
Definition operations.h:27
constexpr auto operator<=>(MoveIterator< Iter > const &a, MoveIterator< U > const &b)
Definition move_iterator.h:90
RepeatView(T, Bound) -> RepeatView< T, Bound >
constexpr auto operator-(MoveIterator< Iter > const &a, MoveIterator< U > const &b) -> decltype(a.base() - b.base())
Definition move_iterator.h:95
constexpr auto move
Definition move.h:38
constexpr auto unreachable_sentinel
Definition unreachable_sentinel.h:11
constexpr auto operator==(MoveIterator< Iter > const &a, MoveIterator< U > const &b) -> bool
Definition move_iterator.h:85
constexpr auto to_unsigned
Definition to_unsigned.h:16
Definition iterator_base.h:14
Definition unreachable_sentinel.h:4