operator==,!=,<,<=,>,>=,<=> (std::move_iterator)
|
헤더 파일에 정의됨
<iterator>
|
||
|
template
<
class
Iter1,
class
Iter2
>
bool
operator
==
(
const
std::
move_iterator
<
Iter1
>
&
lhs,
|
(1) | (C++17부터 constexpr) |
|
template
<
class
Iter1,
class
Iter2
>
bool
operator
!
=
(
const
std::
move_iterator
<
Iter1
>
&
lhs,
|
(2) |
(C++17부터 constexpr)
(C++20 이전) |
|
template
<
class
Iter1,
class
Iter2
>
bool
operator
<
(
const
std::
move_iterator
<
Iter1
>
&
lhs,
|
(3) | (constexpr since C++17) |
|
template
<
class
Iter1,
class
Iter2
>
bool
operator
<=
(
const
std::
move_iterator
<
Iter1
>
&
lhs,
|
(4) | (C++17부터 constexpr) |
|
template
<
class
Iter1,
class
Iter2
>
bool
operator
>
(
const
std::
move_iterator
<
Iter1
>
&
lhs,
|
(5) | (C++17부터 constexpr) |
|
template
<
class
Iter1,
class
Iter2
>
bool
operator
>=
(
const
std::
move_iterator
<
Iter1
>
&
lhs,
|
(6) | (C++17부터 constexpr) |
|
template
<
class
Iter1,
std::
three_way_comparable_with
<
Iter1
>
Iter2
>
constexpr
std::
compare_three_way_result_t
<
Iter1, Iter2
>
|
(7) | (C++20부터) |
lhs 와 rhs 의 기반 반복자들을 비교합니다.
|
1)
이 오버로드는 다음 조건에서만 오버로드 해결에 참여합니다:
lhs.
base
(
)
==
rhs.
base
(
)
이 형식이 잘 구성되고
bool
로 변환 가능한 경우.
3-6)
이 오버로드들은 다음 조건에서만 오버로드 해결에 참여합니다:
lhs.
base
(
)
<
rhs.
base
(
)
이 형식이 잘 구성되고
bool
로 변환 가능한 경우.
|
(since C++20) |
목차 |
매개변수
| lhs, rhs | - | 비교를 위한 반복자 어댑터 |
반환값
예제
#include <cassert> #include <iterator> int main() { int a[]{9, 8, 7, 6}; // │ └───── x, y // └──────── z // “x”와 “y”는 동일하지만, “x”가 “z”보다 큽니다 std::move_iterator<int*> x{std::end(a) - 1}, y{std::end(a) - 1}, z{std::end(a) - 2}; // 이항 비교 assert( x == y ); assert(!(x != y)); assert(!(x < y)); assert( x <= y ); assert(!(x == z)); assert( x != z ); assert(!(x < z)); assert(!(x <= z)); // 삼항 비교 assert( x <=> y == 0 ); assert(!(x <=> y < 0)); assert(!(x <=> y > 0)); assert(!(x <=> z == 0)); assert(!(x <=> z < 0)); assert( x <=> z > 0 ); }
참고 항목
|
(C++20)
|
기본 반복자와 기본 센티널을 비교함
(함수 템플릿) |