std::ranges::repeat_view<W, Bound>::iterator
< cpp | ranges | repeat view
|
struct /*iterator*/;
|
(C++23 起) (仅用于阐述*) |
|
repeat_view::begin 的返回类型。
成员类型
| 成员类型 | 定义 |
index-type |
|
iterator_concept |
std::random_access_iterator_tag |
iterator_category |
std::random_access_iterator_tag |
value_type |
W |
difference_type |
|
数据成员
| 成员名 | 定义 |
value_ (私有) |
const W* 类型的指针,持有指向重复生成的值的指针。 (仅用于阐述的成员对象*) |
current_ (私有) |
/*index-type*/ 类型的对象,持有当前位置。 (仅用于阐述的成员对象*) |
成员函数
|
(构造函数)
|
构造迭代器 (公开成员函数) |
|
operator*
|
返回值 (公开成员函数) |
|
operator[]
|
按索引访问元素 (公开成员函数) |
|
operator++operator++(int)operator--operator--(int)operator+=operator-=
|
推进或减小底层迭代器 (公开成员函数) |
std::ranges::repeat_view::iterator::iterator
|
/*iterator*/() = default;
|
(1) | (C++23 起) |
|
constexpr explicit /*iterator*/(
const W* value, /*index-type*/ b = /*index-type*/() ); |
(2) | (C++23 起) (仅用于阐述*) |
1) 值初始化各数据成员:
value_以 nullptr_t 通过其默认成员初始化式初始化;index_通过其默认成员初始化式(= /*index-type*/())初始化。
2) 以
value 值初始化 value_,并以 b 值初始化 bound_。如果 Bound 不是 std::unreachable_sentinel_t 那么 b 必须非负。此构造函数不属于公开接口。std::ranges::repeat_view::iterator::operator*
|
constexpr const W& operator*() const noexcept;
|
(C++23 起) | |
等价于 return *value_;。
std::ranges::repeat_view::iterator::operator[]
|
constexpr const W& operator[]( difference_type n ) const noexcept;
|
(C++23 起) | |
等价于 return *(*this + n);。
std::ranges::repeat_view::iterator::operator++
|
constexpr /*iterator*/& operator++();
|
(1) | (C++23 起) |
|
constexpr void operator++(int);
|
(2) | (C++23 起) |
1) 等价于 ++current_; return *this;。
2) 等价于 auto tmp = *this; ++*this; return tmp;。
std::ranges::repeat_view::iterator::operator--
|
constexpr /*iterator*/& operator--();
|
(1) | (C++23 起) |
|
constexpr /*iterator*/ operator--(int);
|
(2) | (C++23 起) |
1) 等价于 --current_; return *this;。如果 Bound 不是 std::unreachable_sentinel_t 那么
bound_ 必须为正。2) 等价于 auto tmp = *this; --*this; return tmp;。
std::ranges::repeat_view::iterator::operator+=
|
constexpr /*iterator*/& operator+=( difference_type n );
|
(C++23 起) | |
等价于 current_ += n; return *this;。如果 Bound 不是 std::unreachable_sentinel_t 那么 (bound_ + n) 必须非负。
std::ranges::repeat_view::iterator::operator-=
|
constexpr /*iterator*/& operator-=( difference_type n );
|
(C++23 起) | |
等价于 current_ -= n; return *this;。如果 Bound 不是 std::unreachable_sentinel_t,那么 (bound_ - n) 必须非负。
非成员函数
|
operator==operator<=>
(C++23)
|
比较底层迭代器 (函数) |
|
operator+operator-
(C++23)
|
实施迭代器算术 (函数) |
operator==, <=>(std::ranges::repeat_view::iterator)
|
friend constexpr bool operator==( const /*iterator*/& x, const /*iterator*/& y );
|
(1) | (C++23 起) |
|
friend constexpr auto operator<=>( const /*iterator*/& x, const /*iterator*/& y );
|
(2) | (C++23 起) |
1) 等价于 x.current_ == y.current_。
2) 等价于 x.current_ <=> y.current_。
!= 运算符从 operator== 运算符合成。
operator+(std::ranges::repeat_view::iterator)
|
friend constexpr /*iterator*/ operator+( /*iterator*/ i, difference_type n );
|
(1) | (C++23 起) |
|
friend constexpr /*iterator*/ operator+( difference_type n, /*iterator*/ i );
|
(2) | (C++23 起) |
等价于 i += n; return i;。
operator-(std::ranges::repeat_view::iterator)
|
friend constexpr /*iterator*/ operator-( /*iterator*/ i, difference_type n );
|
(1) | (C++23 起) |
|
friend constexpr difference_type operator-( const /*iterator*/& x,
const /*iterator*/& y ); |
(2) | (C++23 起) |
1) 等价于 i -= n; return i;。
2) 等价于 return static_cast<difference_type>(x.current_) - static_cast<difference_type>(y.current_);。
注解
iterator 始终是 random_access_iterator。