std::owner_hash

Header: <memory>

This function object provides owner-based (as opposed to value-based) hashing of both std::weak_ptr and std::shared_ptr.

# Declarations

struct owner_hash;

(since C++26)

# Parameters

# Return value

A hash value that is identical for any std::shared_ptr or std::weak_ptr object sharing the same ownership.

# Notes

Feature-test macro Value Std Feature __cpp_lib_smart_ptr_owner_equality 202306L (C++26) Enabling the use of std::shared_ptr and std::weak_ptr as keys in unordered associative containers

# See also