operator==,<=> (std::inplace_vector)
|
constexpr
friend
bool
operator
==
(
const
std::
inplace_vector
<
T, N
>
&
lhs,
const std:: inplace_vector < T, N > & rhs ) ; |
(1) | (C++26以降) |
|
constexpr
friend
synth
-
three
-
way
-
result
<
T
>
operator
<=>
(
const
std::
inplace_vector
<
T, N
>
&
lhs,
|
(2) | (C++26以降) |
2つの std::inplace_vector の内容を比較します。
std:: lexicographical_compare_three_way ( lhs. begin ( ) , lhs. end ( ) ,
rhs. begin ( ) , rhs. end ( ) , synth - three - way ) ; 。
-
Tがthree_way_comparableをモデル化していること。 -
<が型(const修飾されている可能性もある)Tの値に対して定義されており、かつ<が全順序関係であること。
<
、
<=
、
>
、
>=
、および
!=
演算子は、それぞれ
合成されます
operator
<=>
および
operator
==
から。
目次 |
パラメータ
| lhs, rhs | - | std::inplace_vector の比較対象となる内容 |
-
T
はオーバーロード(1)を使用するために
EqualityComparable
の要件を満たさなければならない
|
||
戻り値
計算量
注記
関係演算子は synth-three-way によって定義され、可能な場合は operator <=> を、そうでない場合は operator < を使用します。
特に、要素自体が operator <=> を提供していないが、三方比較可能な型への暗黙変換が可能な場合、その変換が operator < の代わりに使用されます。
例
#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 ("" "等しいコンテナの比較:" && (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 && "等しくないコンテナの比較:" && (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 && ""); }