std::move_iterator 연산자

std::move_iterator 연산자 (operator== 등)

std::move_iterator를 비교하는 연산자들이에요. 기본 반복자에 대한 비교를 위임해요. C++11부터 있어요(C++17부터 constexpr).

출처: cppreference

본문

<iterator> 헤더에 정의돼 있어요.

// (1) C++11 (C++17부터 constexpr)
template< class Iter1, class Iter2 >
bool operator==( const std::move_iterator<Iter1>& lhs,
                 const std::move_iterator<Iter2>& rhs );

// (2) C++20까지
template< class Iter1, class Iter2 >
bool operator!=( const std::move_iterator<Iter1>& lhs,
                 const std::move_iterator<Iter2>& rhs );

// (3) C++11부터 operator<
template< class Iter1, class Iter2 >
bool operator< ( const std::move_iterator<Iter1>& lhs,
                 const std::move_iterator<Iter2>& rhs );

// (4) C++11부터 operator<=
template< class Iter1, class Iter2 >
bool operator<=( const std::move_iterator<Iter1>& lhs,
                 const std::move_iterator<Iter2>& rhs );

// (5) C++11부터 operator>
// (6) C++11부터 operator>=
template< class Iter1, class Iter2 >
bool operator> ( const std::move_iterator<Iter1>& lhs,
                 const std::move_iterator<Iter2>& rhs );

std::move_iterator를 비교해요. 기본 반복자를 비교한 결과를 돌려줘요. operator!=, operator>, operator>=는 (1), (3)으로부터 유도돼요. C++20부터는 operator<=>가 도입돼 <, <=, >, >=, !=operator<=>operator==로부터 합성돼요.

반환값

  • lhs.base() == rhs.base(), lhs.base() < rhs.base() 등 기본 반복자에 대한 비교 결과.

더 알아보기 (Learn more)

cppreference