Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::weak_ptr<T>::owner_hash

      From cppreference.com
      <cpp‎ |memory‎ |weak ptr

      [edit template]
       
       
      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*)
      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()constnoexcept;
      (since C++26)

      Returns an unspecified value such that for any objectother whereowner_equal(other) istrue,owner_hash()== other.owner_hash() istrue.

      This hashing is used to make shared and weak pointers usable as keys in unordered associative containers, typically throughstd::owner_hash.

      Contents

      [edit]Return value

      A value that is identical for anystd::shared_ptr orstd::weak_ptr object sharing the same ownership.

      [edit]Notes

      Feature-test macroValueStdFeature
      __cpp_lib_smart_ptr_owner_equality202306L(C++26)Enabling the use ofstd::weak_ptr as keys inunordered associative containers

      [edit]Example

      This section is incomplete
      Reason: example

      [edit]See also

      (C++26)
      provides owner-based hashing for shared and weak pointers
      (class)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/memory/weak_ptr/owner_hash&oldid=165927"

      [8]ページ先頭

      ©2009-2025 Movatter.jp