operator==, <=> (std::reference_wrapper)
|
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Old binders and adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
Member functions | ||||
Non-member functions | ||||
operator==
operator<=>
(C++26)
(C++26)
|
||||
Deduction guides (C++17) | ||||
Helper classes | ||||
friend
constexpr
bool
operator == ( reference_wrapper lhs, reference_wrapper rhs ) ; |
(1) | (since C++26) |
friend
constexpr
bool
operator == ( reference_wrapper lhs, reference_wrapper < const T > rhs ) ; |
(2) | (since C++26) |
friend
constexpr
bool
operator == ( reference_wrapper lhs, const T & ref ) ; |
(3) | (since C++26) |
friend
constexpr
auto
operator <=> ( reference_wrapper lhs, reference_wrapper rhs ) ; |
(4) | (since C++26) |
friend
constexpr
auto
operator <=> ( reference_wrapper lhs, reference_wrapper < const T > rhs ) ; |
(5) | (since C++26) |
friend
constexpr
auto
operator <=> ( reference_wrapper lhs, const T & ref ) ; |
(6) | (since C++26) |
Performs comparison operations on
reference_wrapper
objects.
reference_wrapper
objects. The objects compare equal if and only if
lhs.
get
(
)
and
rhs.
get
(
)
are equal.
- Both overloads participate in overload resolution only if lhs. get ( ) == rhs. get ( ) is well-formed and its result is convertible to bool .
- The overload (2) participates in overload resolution only if std:: is_const_v < T > is false .
reference_wrapper
object with a reference. The parameters compare equal if and only if
lhs.
get
(
)
is equal to
ref
.
- The overload (3) participates in overload resolution only if lhs. get ( ) == ref is well-formed and its result is convertible to bool .
reference_wrapper
objects as if by
synth-three-way
(
lhs.
get
(
)
, rhs.
get
(
)
)
. The return type is
synth-three-way-result
<T>
. This overload participates in overload resolution only if the return type is well-formed.
reference_wrapper
objects as if by
synth-three-way
(
lhs.
get
(
)
, rhs.
get
(
)
)
. The return type is
synth-three-way-result
<T>
. This overload participates in overload resolution only if
std::
is_const_v
<
T
>
is
false
and the return type is well-formed.
reference_wrapper
object with a reference as if by
synth-three-way
(
lhs.
get
(
)
, ref
)
. The return type is
synth-three-way-result
<T>
. This overload participates in overload resolution only if the return type is well-formed.
The
<
,
<=
,
>
,
>=
, and
!=
operators are
synthesized
from
operator
<=>
and
operator
==
respectively.
Parameters
lhs, rhs | - |
reference_wrapper
object to compare
|
ref | - |
reference to compare to the
reference_wrapper
object
|
Return value
Exceptions
Throws when and what the comparison throws.
Notes
The return types of
(
4-6
)
are
deduced from
return
statements
to avoid hard error when instantiating a
std::
reference_wrapper
<
T
>
with
synth-three-way-result
<T>
being ill-formed.
Feature-test macro | Value | Std | Feature |
---|---|---|---|
__cpp_lib_reference_wrapper
|
202403L | (C++26) |
Comparisons for
std::reference_wrapper
|
Example
This section is incomplete
Reason: no example |