std:: owner_equal
|
定義先ヘッダ
<memory>
|
||
|
struct
owner_equal
;
|
(C++26以降) | |
この関数オブジェクトは、所有者ベース(値ベースではなく)の混合型等値比較を
std::weak_ptr
および
std::shared_ptr
に対して提供します。この比較は、2つのスマートポインタがともに空である場合、または所有権を共有している場合にのみ等価と判定されます。たとえ
get()
によって取得された生ポインタの値が異なっていても(例えば同じオブジェクト内の異なるサブオブジェクトを指している場合など)、この条件は変わりません。
std::owner_equal
は引数からパラメータ型を推論します。
目次 |
ネストされた型
| ネストされた型 | 定義 |
is_transparent
|
unspecified |
メンバー関数
|
operator()
|
引数を所有者ベースのセマンティクスを使用して比較する
(関数) |
std::owner_equal:: operator()
|
template
<
class
T,
class
U
>
bool
operator
(
)
(
const
std::
shared_ptr
<
T
>
&
lhs,
|
(C++26以降) | |
|
template
<
class
T,
class
U
>
bool
operator
(
)
(
const
std::
shared_ptr
<
T
>
&
lhs,
|
(C++26以降) | |
|
template
<
class
T,
class
U
>
bool
operator
(
)
(
const
std::
weak_ptr
<
T
>
&
lhs,
|
(C++26以降) | |
|
template
<
class
T,
class
U
>
bool
operator
(
)
(
const
std::
weak_ptr
<
T
>
&
lhs,
|
(C++26以降) | |
lhs と rhs を所有権ベースのセマンティクスで比較します。実質的に lhs. owner_equal ( rhs ) を呼び出します。
等値比較は同値関係です。
lhs と rhs は、両方が空であるか、所有権を共有している場合にのみ等価です。
パラメータ
| lhs, rhs | - | 比較する共有所有権ポインタ |
戻り値
lhs と rhs が両方とも空であるか、所有権ベースの等値比較によって決定される所有権を共有している場合は true 、それ以外の場合は false 。
注記
| 機能テスト マクロ | 値 | 標準 | 機能 |
|---|---|---|---|
__cpp_lib_smart_ptr_owner_equality
|
202306L
|
(C++26) |
std::shared_ptr
および
std::weak_ptr
を
非順序連想コンテナ
のキーとして使用可能にする
|
関連項目
|
(C++26)
|
shared pointerのオーナーベースの等値比較を提供する
(
std::shared_ptr<T>
のpublicメンバ関数)
|
|
(C++26)
|
weak pointerのオーナーベースの等値比較を提供する
(
std::weak_ptr<T>
のpublicメンバ関数)
|