std::ranges::iota_view<W, Bound>::sentinel

来自cppreference.com
< cpp‎ | ranges‎ | iota view
 
 
 
 
template<class W, class Bound>
struct /*sentinel*/;

iota_view::end 的返回类型,在 iota_view 有界(即 Bound 不是 std::unreachable_sentinel_t )且 BoundW 不是同一类型时使用。

此类的名字(此处示作 /*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)

    requires std::sized_sentinel_for<Bound, W>;
(1)
friend constexpr std::iter_difference_t<W>

    operator-(const /*sentinel*/& x, const /*iterator*/& y)

    requires std::sized_sentinel_for<Bound, W>;
(2)
1) 等价于 return x.value_ - y.bound_;
2) 等价于 return -(y.value_ - x.bound_);