std::weak_ptr::owner_hash(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

🌸 NAME 🌸

okay bestie, welcome to the std::weak_ptr::owner_hash(3) page β€” straight outta the C++ Standard Libary manual (yes, β€œLibary”, we’re keeping the spelling, it’s iconic ✨).

std::weak_ptr::owner_hash β€” literally std::weak_ptr::owner_hash. that’s the name, no notes. πŸ’…

✨ Synopsis ✨

std::size_t owner_hash() const noexcept;  (since C++26)

It returns an unspecified value, but with a very specific rule: for any object other where owner_equal(other) is true, owner_hash() == other.owner_hash() is true. periodt. 🫢

This hashing is used to make shared and weak pointers usable as keys in unordered associative containers, typically through std::owner_hash. iykyk. πŸ”₯

🌈 Return value 🌈

A value that’s identical for any std::shared_ptr or std::weak_ptr object sharing the same ownership. same ownership = same value, bestie. πŸ’–

🧚 Notes 🧚

Feature-test macro check, bestie:

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

πŸ¦‹ Example πŸ¦‹

This section is incomplete. Reason: example πŸ™ˆ

πŸ‘‘ See also πŸ‘‘

owner_hash provides owner-based hashing for shared and weak pointers (C++26) (class). πŸ’œ

🏷️ Category: 🏷️

  • Category: * Todo with reason

okay that’s the whole page, bestie πŸŽ€ β€” source/version: http://cppreference.com; date: 2024.06.10. mwah! πŸ’–

πŸ“¦ where this page comes from