Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::enable_shared_from_this<T>::weak_from_this

      From cppreference.com
      <cpp‎ |memory‎ |enable shared from this
       
       
      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::weak_ptr<T> weak_from_this()noexcept;
      (1)(since C++17)
      std::weak_ptr<Tconst> weak_from_this()constnoexcept;
      (2)(since C++17)

      Returns astd::weak_ptr<T> that tracks ownership of*this by all existingstd::shared_ptr that refer to*this.

      Contents

      [edit]Return value

      weak_this

      [edit]Notes

      Feature-test macroValueStdFeature
      __cpp_lib_enable_shared_from_this201603L(C++17)std::enable_shared_from_this::weak_from_this

      [edit]Example

      This section is incomplete
      Reason: no example

      [edit]See also

      (C++11)
      smart pointer with shared object ownership semantics
      (class template)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/memory/enable_shared_from_this/weak_from_this&oldid=177230"

      [8]ページ先頭

      ©2009-2025 Movatter.jp