operator==,<=> (std::inplace_vector)
constexpr
friend
bool
operator
==
(
const
std::
inplace_vector
<
T, N
>
&
lhs,
const std:: inplace_vector < T, N > & rhs ) ; |
(1) | (since C++26) |
constexpr
friend
synth
-
three
-
way
-
result
<
T
>
operator
<=>
(
const
std::
inplace_vector
<
T, N
>
&
lhs,
|
(2) | (since C++26) |
Compares the contents of two std::inplace_vector s.
std:: lexicographical_compare_three_way ( lhs. begin ( ) , lhs. end ( ) ,
rhs. begin ( ) , rhs. end ( ) , synth - three - way ) ; .
-
T
modelsthree_way_comparable
. -
<
is defined for values of type (possibly const-qualified)T
, and<
is a total ordering relationship.
The
<
,
<=
,
>
,
>=
, and
!=
operators are
synthesized
from
operator
<=>
and
operator
==
respectively.
Parameters
lhs, rhs | - | std::inplace_vector s whose contents to compare |
-
T
must meet the requirements of
EqualityComparable
in order to use overloads (1).
|
Return value
Complexity
Notes
The relational operators are defined in terms of synth-three-way , which uses operator <=> if possible, or operator < otherwise.
Notably, if the element does not itself provide operator <=> , but is implicitly convertible to a three-way comparable type, that conversion will be used instead of operator < .
Example
#include <inplace_vector> int main() { constexpr std::inplace_vector<int, 4> a{1, 2, 3}, b{1, 2, 3}, c{7, 8, 9, 10}; static_assert ("" "Compare equal containers:" && (a != b) == false && (a == b) == true && (a < b) == false && (a <= b) == true && (a > b) == false && (a >= b) == true && (a <=> b) >= 0 && (a <=> b) <= 0 && (a <=> b) == 0 && "Compare non equal containers:" && (a != c) == true && (a == c) == false && (a < c) == true && (a <= c) == true && (a > c) == false && (a >= c) == false && (a <=> c) < 0 && (a <=> c) != 0 && (a <=> c) <= 0 && ""); }