|
JH-Toolkit v1.4.1
An engineering-oriented C++20 toolkit with duck-typed concepts, static design, async coroutines, and semantic containers โ header-only, RTTI-free, and concurrency-friendly.
|
Content-based hash functor for std::weak_ptr<T>.
More...
#include <jh/concurrent/observe_pool.h>
Public Member Functions | |
| std::size_t | operator() (const std::weak_ptr< T > &ptr) const noexcept |
Content-based hash functor for std::weak_ptr<T>.
jh::hash<T> functor to the underlying object. jh::observe_pool by performing a single well-defined hash access per locked instance. Enables jh::observe_pool and jh::conc::pointer_pool to hash weakly referenced shared objects by logical content, without altering ownership or extending object lifetimes.
Starting with 1.3.5, weak_ptr_hash<T> supports automatic hash deduction through jh::hash<T>, which transparently resolves hashing via the following precedence chain:
std::hash<T>{ }(v)
> hash(v)
> v.hash()
This allows any type declaring a valid hash mechanism โ standard, ADL-based, or member-based โ to participate in pooling without the need for custom specialization.
| T | The managed type, which must satisfy jh::concepts::extended_hashable. |