std::owner_hash
From cppreference.com
| ヘッダ <memory> で定義 |
||
| struct owner_hash; |
(C++26以降) | |
この関数オブジェクトは、std::weak_ptr と std::shared_ptr の両方に対して、値ベースではなくオーナーベースのハッシュを提供します。
目次 |
[編集] ネストされた型
| ネストされた型 | 定義 |
is_transparent
|
unspecified |
[編集] メンバ関数
| operator() |
共有所有権ポインタのハッシュを計算します。 (関数) |
std::owner_hash::operator()
| template< class T > std::size_t operator()( const std::shared_ptr<T>& key ) const noexcept; |
(1) | (C++26以降) |
| template< class T > std::size_t operator()( const std::weak_ptr<T>& key ) const noexcept; |
(2) | (C++26以降) |
return key.owner_hash(); と同等です。
パラメータ
| key | - | ハッシュする共有所有権ポインタ |
戻り値
同じ所有権を共有する任意の std::shared_ptr または std::weak_ptr オブジェクトに対して同一のハッシュ値。
[編集] 注記
| 機能テストマクロ | 値 | 規格 | 機能 |
|---|---|---|---|
__cpp_lib_smart_ptr_owner_equality |
202306L |
(C++26) | 順序なし連想コンテナのキーとして std::shared_ptr と std::weak_ptr を使用できるようにします。 |
[編集] 関連項目
| (C++26) |
共有ポインタのオーナーベースのハッシュを提供します。 ( std::shared_ptr<T> の公開メンバ関数) |
| (C++26) |
弱ポインタのオーナーベースのハッシュを提供します。 ( std::weak_ptr<T> の公開メンバ関数) |