operator==,!=,<,<=,>,>=,<=>(std::move_iterator)

(1)
template< class Iterator1, class Iterator2 >

bool operator==( const std::move_iterator<Iterator1>& lhs,

                 const std::move_iterator<Iterator2>& rhs );
(C++17 前)
template< class Iterator1, class Iterator2 >

constexpr bool operator==( const std::move_iterator<Iterator1>& lhs,

                           const std::move_iterator<Iterator2>& rhs );
(C++17 起)
(2)
template< class Iterator1, class Iterator2 >

bool operator!=( const std::move_iterator<Iterator1>& lhs,

                 const std::move_iterator<Iterator2>& rhs );
(C++17 前)
template< class Iterator1, class Iterator2 >

constexpr bool operator!=( const std::move_iterator<Iterator1>& lhs,

                           const std::move_iterator<Iterator2>& rhs );
(C++17 起)
(C++20 前)
(3)
template< class Iterator1, class Iterator2 >

bool operator<( const std::move_iterator<Iterator1>& lhs,

                const std::move_iterator<Iterator2>& rhs );
(C++17 前)
template< class Iterator1, class Iterator2 >

constexpr bool operator<( const std::move_iterator<Iterator1>& lhs,

                          const std::move_iterator<Iterator2>& rhs );
(C++17 起)
(4)
template< class Iterator1, class Iterator2 >

bool operator<=( const std::move_iterator<Iterator1>& lhs,

                 const std::move_iterator<Iterator2>& rhs );
(C++17 前)
template< class Iterator1, class Iterator2 >

constexpr bool operator<=( const std::move_iterator<Iterator1>& lhs,

                           const std::move_iterator<Iterator2>& rhs );
(C++17 起)
(5)
template< class Iterator1, class Iterator2 >

bool operator>( const std::move_iterator<Iterator1>& lhs,

                const std::move_iterator<Iterator2>& rhs );
(C++17 前)
template< class Iterator1, class Iterator2 >

constexpr bool operator>( const std::move_iterator<Iterator1>& lhs,

                          const std::move_iterator<Iterator2>& rhs );
(C++17 起)
(6)
template< class Iterator1, class Iterator2 >

bool operator>=( const std::move_iterator<Iterator1>& lhs,

                 const std::move_iterator<Iterator2>& rhs );
(C++17 前)
template< class Iterator1, class Iterator2 >

constexpr bool operator>=( const std::move_iterator<Iterator1>& lhs,

                           const std::move_iterator<Iterator2>& rhs );
(C++17 起)
template<class Iterator1, std::three_way_comparable_with<Iterator1> Iterator2>

constexpr std::compare_three_way_result_t<Iterator1, Iterator2>
    operator<=>( const std::move_iterator<Iterator1>& x,

                 const std::move_iterator<Iterator2>& y );
(7) (C++20 起)

比较底层迭代器。

(1-6) 仅若其底层比较表达式(见后述)为良构且可转换为 bool 才参与重载决议。

!= 运算符从 operator== 合成

(C++20 起)

参数

lhs, rhs - 要比较的迭代器适配器

返回值

1) lhs.base() == rhs.base()
2) !(lhs == rhs)
3) lhs.base() < rhs.base()
4) !(rhs < lhs)
5) rhs < lhs
6) !(lhs < rhs)
7) lhs.base() <=> rhs.base()

示例