Namespaces
Variants

std:: owner_hash

From cppreference.net
Memory management library
( exposition only* )
Allocators
Uninitialized memory algorithms
Constrained uninitialized memory algorithms
Memory resources
Uninitialized storage (until C++20)
( until C++20* )
( until C++20* )
( until C++20* )

Garbage collector support (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
定義先ヘッダ <memory>
struct owner_hash ;
(C++26以降)

この関数オブジェクトは、 std::weak_ptr および std::shared_ptr の値ベース(value-based)ではなく所有者ベース(owner-based)のハッシュ処理を提供します。

目次

ネストされた型

ネストされた型 定義
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> の公開メンバ関数)