Namespaces
Variants

std::shared_ptr<T>:: 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)
std:: size_t owner_hash ( ) const noexcept ;
(seit C++26)

Gibt einen nicht spezifizierten Wert zurück, sodass für jedes Objekt other , für das owner_equal ( other ) true ist, owner_hash ( ) == other. owner_hash ( ) ebenfalls true ist.

Dieses Hashing wird verwendet, um shared und weak pointers als Schlüssel in ungeordneten assoziativen Containern nutzbar zu machen, typischerweise durch std::owner_hash .

Inhaltsverzeichnis

Rückgabewert

Ein Wert, der für jedes std::shared_ptr oder std::weak_ptr Objekt identisch ist, das denselben Besitz teilt.

Hinweise

Feature-Test Makro Wert Std Funktion
__cpp_lib_smart_ptr_owner_equality 202306L (C++26) Ermöglicht die Verwendung von std::shared_ptr als Schlüssel in ungeordneten assoziativen Containern

Beispiel

Siehe auch

(C++26)
bietet owner-basiertes Hashing für shared und weak Pointer
(Klasse)