std::weak_ptr<T> weak_from_this(); | (1) | (since C++17) |
std::weak_ptr<T const> weak_from_this() const; | (2) | (since C++17) |
Returns a std::weak_ptr<T>
that tracks ownership of *this
by all existing std::shared_ptr
that refer to *this
.
This is a copy of the the private mutable weak_ptr
member that is part of enabled_shared_from_this
.
std::weak_ptr<T>
that shares ownership of *this
with pre-existing std::shared_ptr
s.
noexcept
specification: noexcept
(C++11)
| smart pointer with shared object ownership semantics (class template) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/memory/enable_shared_from_this/weak_from_this