Namespaces
Variants

operator==,<,>,<=,>=,<=>(ranges::stride_view::iterator)

来自 zh.cppreference.net
 
 
范围库
范围适配器
 
 
friend constexpr bool operator==( const /*iterator*/& x, std::default_sentinel_t );
(1) (C++23 起)
friend constexpr bool operator==( const /*iterator*/& x, const /*iterator*/& y )
    requires std::equality_comparable<ranges::iterator_t<Base>>;
(2) (C++23 起)
friend constexpr bool operator<( const /*iterator*/& x, const /*iterator*/& y )
    requires ranges::random_access_range<Base>;
(3) (C++23 起)
friend constexpr bool operator>( const /*iterator*/& x, const /*iterator*/& y )
    requires ranges::random_access_range<Base>;
(4) (C++23 起)
friend constexpr bool operator<=( const /*iterator*/& x, const /*iterator*/& y )
    requires ranges::random_access_range<Base>;
(5) (C++23 起)
friend constexpr bool operator>=( const /*iterator*/& x, const /*iterator*/& y )
    requires ranges::random_access_range<Base>;
(6) (C++23 起)
friend constexpr auto operator<=>( const /*iterator*/& x, const /*iterator*/& y )
    requires ranges::random_access_range<Base> and
             std::three_way_comparable<ranges::iterator_t<Base>>;
(7) (C++23 起)

比较底层迭代器/哨位。

设 current_ 为底层迭代器,end_ 为底层哨位。

1) 等价于 return x.current_ == x.end_;。
2) 等价于 return x.current_ == y.current_;。
3) 等价于 return x.current_ < y.current_;。
4) 等价于 return y < x;
5) 等价于 return !(y < x);
6) 等价于 return !(x < y);
7) 等价于 return x.current_ <=> y.current_;。

这些函数对普通的无限定或有限定查找不可见,仅当 参数依赖查找且 std::ranges::stride_view::iterator<Const>是参数关联类时才能找到。

!= 运算符由 合成operator==。

参数

x, y - 待比较的迭代器

返回值

比较结果

示例