std::owner_hash(3)
π¦ std::owner_hash(3) π¦
okay so bestie, welcome to std::owner_hash(3) β this is straight outta the C++ Standard Libary manual. we're talking owner-based hashing today, and yes it's giving main character energy. π
πΈ NAME πΈ
std::owner_hash - std::owner_hash
β¨ Synopsis β¨
bestie, here's where it lives:
Defined in header <memory>
struct owner_hash; (since C++26)
This function object provides owner-based (as opposed to value-based) hashing of both std::weak_ptr and std::shared_ptr. no cap, that's the whole vibe. π«Ά
π Member functions π
operator()β calculates the hash of the shared-ownership pointer (function)
π std::owner_hash::operator() π
the signatures are literally right here:
template< class T >
std::size_t operator()( const std::shared_ptr<T>& key ) const
(1) (since C++26)
noexcept;
template< class T >
std::size_t operator()( const std::weak_ptr<T>& key ) const
(2) (since C++26)
noexcept;
Equivalent to return key.owner_hash();.
π Parameters π
keyβ shared-ownership pointer to be hashed
π Return value π
A hash value that is identical for any std::shared_ptr or std::weak_ptr object sharing the same ownership. slay, consistency. β¨
π₯ Notes π₯
here's the feature-test macro tea, bestie:
- Feature-test macro:
__cpp_lib_smart_ptr_owner_equality - Value:
202306L - Std:
(C++26) - Feature: Enabling the use of
std::shared_ptrandstd::weak_ptras keys in unordered associative containers
π See also π
owner_hashprovides owner-based hashing of shared pointers(C++26)β (public member function ofstd::shared_ptr<T>)owner_hashprovides owner-based hashing of weak pointers(C++26)β (public member function ofstd::weak_ptr<T>)
okay that's the whole page, bestie π«Ά source: http://cppreference.com Β· date: 2024.06.10 Β· page: std::owner_hash(3). go be iconic with your hashing, periodt πβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms