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

来自cppreference.com


 
 
范围库
范围适配器
 
 
friendconstexprbool operator==(const/*iterator*/& x, const/*iterator*/& y )
    requires std::equality_comparable<ranges::iterator_t<Base>>;
(1) (C++20 起)
friendconstexprbool operator<(const/*iterator*/& x, const/*iterator*/& y )
    requires ranges::random_access_range<Base>;
(2) (C++20 起)
friendconstexprbool operator>(const/*iterator*/& x, const/*iterator*/& y )
    requires ranges::random_access_range<Base>;
(3) (C++20 起)
friendconstexprbool operator<=(const/*iterator*/& x, const/*iterator*/& y )
    requires ranges::random_access_range<Base>;
(4) (C++20 起)
friendconstexprbool operator>=(const/*iterator*/& x, const/*iterator*/& y )
    requires ranges::random_access_range<Base>;
(5) (C++20 起)
friendconstexprauto operator<=>(const/*iterator*/& x, const/*iterator*/& y )

    requires ranges::random_access_range<Base>&&

             std::three_way_comparable<ranges::iterator_t<Base>>;
(6) (C++20 起)

比较底层迭代器。

1) 等价于 return x.current_== y.current_;,其中 current_ 是底层迭代器。
2) 等价于 return x.current_< y.current_;,其中 current_ 是底层迭代器。
3) 等价于 return y < x;
4) 等价于 return!(y < x);
5) 等价于 return!(x < y);
6) 等价于 return x.current_<=> y.current_;,其中 current_ 是底层迭代器。

这些函数对常规的无限定有限定查找不可见,而只能在 std::ranges::transform_view::iterator<Const> 为实参的关联类时由实参依赖查找找到。

!= 运算符从 operator== 运算符合成

[编辑]参数

x, y - 要比较的迭代器

[编辑]返回值

比较的结果

[编辑]参阅

(C++20)
比较哨位与 transform_view::begin 返回的迭代器
(函数)[编辑]
close