std::ranges::iota_view<W, Bound>::sentinel
来自cppreference.com
template<class W, class Bound> struct /*sentinel*/; |
||
iota_view::end 的返回类型,在 iota_view
有界(即 Bound
不是 std::unreachable_sentinel_t )且 Bound
与 W
不是同一类型时使用。
此类的名字(此处示作 /*sentinel*/)是未指定的。
典型实现保有一个 Bound
类型的数据成员(此处示作 bound_),对于有界 iota_view
常为数。
成员函数
std::ranges::iota_view::sentinel::sentinel
/*sentinel*/() = default; |
(1) | |
constexpr explicit /*sentinel*/(Bound bound); |
(2) | |
1) 通过其默认成员初始化器( = Bound() )值初始化 bound_ 。
2) 以 bound 初始化仅用于阐释的数据成员 bound_ 。
非成员函数
这些函数对通常无限定或有限定查找不可见,而只能在 std::ranges::iota_view::sentinel
为参数的关联类时由实参依赖查找找到。
value_
是 iterator
的仅用于阐释的数据成员,其 operator*
从该成员复制。
operator==(std::ranges::iota_view::iterator, std::ranges::iota_view::sentinel)
friend constexpr bool operator==(const /*iterator*/& x, const /*sentinel*/& y); |
||
等价于 return x.value_ == y.bound_; 。
operator-(std::ranges::iota_view::iterator, std::ranges::iota_view::sentinel)
friend constexpr std::iter_difference_t<W> operator-(const /*iterator*/& x, const /*sentinel*/& y) |
(1) | |
friend constexpr std::iter_difference_t<W> operator-(const /*sentinel*/& x, const /*iterator*/& y) |
(2) | |
1) 等价于 return x.value_ - y.bound_; 。
2) 等价于 return -(y.value_ - x.bound_); 。