operator==,!=,<,<=,>,>=,<=> (std::move_iterator)
|
Definiert im Header
<iterator>
|
||
|
template
<
class
Iter1,
class
Iter2
>
bool
operator
==
(
const
std::
move_iterator
<
Iter1
>
&
lhs,
|
(1) | (constexpr seit C++17) |
|
template
<
class
Iter1,
class
Iter2
>
bool
operator
!
=
(
const
std::
move_iterator
<
Iter1
>
&
lhs,
|
(2) |
(constexpr seit C++17)
(bis C++20) |
|
template
<
class
Iter1,
class
Iter2
>
bool
operator
<
(
const
std::
move_iterator
<
Iter1
>
&
lhs,
|
(3) | (constexpr seit C++17) |
|
template
<
class
Iter1,
class
Iter2
>
bool
operator
<=
(
const
std::
move_iterator
<
Iter1
>
&
lhs,
|
(4) | (constexpr seit C++17) |
|
template
<
class
Iter1,
class
Iter2
>
bool
operator
>
(
const
std::
move_iterator
<
Iter1
>
&
lhs,
|
(5) | (constexpr seit C++17) |
|
template
<
class
Iter1,
class
Iter2
>
bool
operator
>=
(
const
std::
move_iterator
<
Iter1
>
&
lhs,
|
(6) | (constexpr seit C++17) |
|
template
<
class
Iter1,
std::
three_way_comparable_with
<
Iter1
>
Iter2
>
constexpr
std::
compare_three_way_result_t
<
Iter1, Iter2
>
|
(7) | (seit C++20) |
Vergleicht die zugrundeliegenden Iteratoren von lhs und rhs .
|
1)
Diese Überladung nimmt nur dann an der Überladungsauflösung teil, wenn
lhs.
base
(
)
==
rhs.
base
(
)
wohlgeformt und konvertierbar zu
bool
ist.
3-6)
Diese Überladungen nehmen nur dann an der Überladungsauflösung teil, wenn
lhs.
base
(
)
<
rhs.
base
(
)
wohlgeformt und konvertierbar zu
bool
ist.
Der
|
(seit C++20) |
Inhaltsverzeichnis |
Parameter
| lhs, rhs | - | Iterator-Adapter zum Vergleichen |
Rückgabewert
Beispiel
#include <cassert> #include <iterator> int main() { int a[]{9, 8, 7, 6}; // │ └───── x, y // └──────── z // “x” und “y” sind gleich, aber “x” ist größer als “z” std::move_iterator<int*> x{std::end(a) - 1}, y{std::end(a) - 1}, z{std::end(a) - 2}; // Zweiwege-Vergleiche assert( x == y ); assert(!(x != y)); assert(!(x < y)); assert( x <= y ); assert(!(x == z)); assert( x != z ); assert(!(x < z)); assert(!(x <= z)); // Dreiwege-Vergleiche assert( x <=> y == 0 ); assert(!(x <=> y < 0)); assert(!(x <=> y > 0)); assert(!(x <=> z == 0)); assert(!(x <=> z < 0)); assert( x <=> z > 0 ); }
Siehe auch
|
(C++20)
|
vergleicht den zugrundeliegenden Iterator und den zugrundeliegenden Sentinel
(Funktions-Template) |