Namespaces
Variants

operator- (ranges::adjacent_view:: sentinel )

From cppreference.net
Ranges library
Range adaptors
template < bool OtherConst >

requires std:: sized_sentinel_for < ranges:: sentinel_t < Base > ,
ranges:: iterator_t < /*maybe-const*/ < OtherConst, V >>>
friend constexpr ranges:: range_difference_t < /*maybe-const*/ < OtherConst, V >>

operator - ( const /*iterator*/ < OtherConst > & x, const /*sentinel*/ & y ) ;
(1) (C++23 起)
template < bool OtherConst >

requires std:: sized_sentinel_for < ranges:: sentinel_t < Base > ,
ranges:: iterator_t < /*maybe-const*/ < OtherConst, V >>>
friend constexpr ranges:: range_difference_t < /*maybe-const*/ < OtherConst, V >>

operator - ( const /*sentinel*/ & y, const /*iterator*/ < OtherConst > & x ) ;
(2) (C++23 起)

计算 x 底层迭代器与 y 底层哨位之间的距离。

current_ 表示 x 中的底层迭代器数组, end_ 表示 y 中的底层哨位。

1) 等价于: return x. current_ . back ( ) - y. end_ ;
2) 等价于: return y. end_ - x. current_ . back ( ) ;

这些函数模板对普通的 非限定查找 限定查找 不可见,仅当 adjacent_view:: sentinel 作为参数的关联类时,通过 实参依赖查找 才能找到它们。

目录

参数

x - 一个 iterator
y - 一个 sentinel

返回值

x y 之间的距离。

示例

参见