struct /*iterator*/; | (1) | (since C++23) |
Helper alias templates | ||
template< class I > using /*iota-diff-t*/ = /* see below */; // exposition only | (2) | (since C++23) |
repeat_view::begin
. The name of this class (shown here as /*iterator*/
) is unspecified./*iota-diff-t*/
calculates the difference type for both iterator types and integer-like types. W
is not an integral type, or if it is an integral type and sizeof(std::iter_difference_t<I>)
is greater than sizeof(I)
, then /*iota-diff-t*/<I>
is std::iter_difference_t<I>
. /*iota-diff-t*/<I>
is a signed integer type of width greater than the width of I
if such a type exists. I
is one of the widest integral types, and /*iota-diff-t*/<I>
is an unspecified signed-integer-like type of width not less than the width of I
. It is unspecified whether /*iota-diff-t*/<I>
models weakly_incrementable
in this case.Member type | Definition |
---|---|
index-type (private) |
The name is for exposition only. |
iterator_concept | std::random_access_iterator_tag |
iterator_category | std::random_access_iterator_tag |
value_type | W |
difference_type |
|
Typical implementation of this iterator type contains two data members:
value_
of type const W*
that holds the pointer to the value to repeat; current_
of type /*index-type*/
that holds the current position. These names are exposition only.
(constructor)
(C++23) | constructs an iterator (public member function) |
operator*
(C++23) | returns the current subrange (public member function) |
operator[]
(C++23) | accesses an element by index (public member function) |
operator++operator++(int)operator--operator--(int)operator+=operator-=
(C++23) | advances or decrements the underlying iterator (public member function) |
/*iterator*/() = default; | (1) | (since C++23) |
constexpr explicit /*iterator*/( // exposition only const W* value, /*index-type*/ b = /*index-type*/() ); | (2) | (since C++23) |
value_
with nullptr_t
via its default member initializer; index_
via its default member initializer (= /*index-type*/()
).value_
with value
and bound_
with b
. If Bound
is not std::unreachable_sentinel_t
then b
must be non-negative. This constructor is not a part of the public interface. constexpr const W& operator*() const noexcept; | (since C++23) |
Equivalent to return *value_;
.
constexpr const W& operator[]( difference_type n ) const noexcept; | (since C++23) |
Equivalent to return *(*this + n);
.
constexpr /*iterator*/& operator++(); | (1) | (since C++23) |
constexpr void operator++(int); | (2) | (since C++23) |
++current_; return *this;
.auto tmp = *this; ++*this; return tmp;
. constexpr /*iterator*/& operator--(); | (1) | (since C++23) |
constexpr /*iterator*/ operator--(int); | (2) | (since C++23) |
--current_; return *this;
. If Bound
is not std::unreachable_sentinel_t
then bound_
must be positive.auto tmp = *this; --*this; return tmp;
. constexpr /*iterator*/& operator+=( difference_type n ); | (since C++23) |
Equivalent to current_ += n; return *this;
. If Bound
is not std::unreachable_sentinel_t
then (bound_ + n)
must be non-negative.
constexpr /*iterator*/& operator-=( difference_type n ); | (since C++23) |
Equivalent to current_ -= n; return *this;
. If Bound
is not std::unreachable_sentinel_t
, then (bound_ - n)
must be non-negative.
operator==operator<=>
(C++23) | compares the underlying iterators (function) |
operator+operator-
(C++23) | performs iterator arithmetic (function) |
friend constexpr bool operator==( const /*iterator*/& x, const /*iterator*/& y ); | (1) | (since C++23) |
friend constexpr auto operator<=>( const /*iterator*/& x, const /*iterator*/& y ); | (2) | (since C++23) |
x.current_ == y.current_
.x.current_ <=> y.current_
.The !=
operator is synthesized from operator==
.
These functions are not visible to ordinary unqualified or qualified lookup, and can only be found by argument-dependent lookup when iterator
is an associated class of the arguments.
friend constexpr /*iterator*/ operator+( /*iterator*/ i, difference_type n ); | (1) | (since C++23) |
friend constexpr /*iterator*/ operator+( difference_type n, /*iterator*/ i ); | (2) | (since C++23) |
Equivalent to i += n; return i;
.
These functions are not visible to ordinary unqualified or qualified lookup, and can only be found by argument-dependent lookup when iterator
is an associated class of the arguments.
friend constexpr /*iterator*/ operator-( /*iterator*/ i, difference_type n ); | (1) | (since C++23) |
friend constexpr difference_type operator-( const /*iterator*/& x, const /*iterator*/& y ); | (2) | (since C++23) |
i -= n; return i;
.return static_cast<difference_type>(x.current_) - static_cast<difference_type>(y.current_);
.These functions are not visible to ordinary unqualified or qualified lookup, and can only be found by argument-dependent lookup when iterator
is an associated class of the arguments.
iterator
is always random_access_iterator
.
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/ranges/repeat_view/iterator