Namespaces
Variants

std::enable_shared_from_this<T>:: weak_from_this

From cppreference.net
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* )
( 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) (C++17 起)
std:: weak_ptr < T const > weak_from_this ( ) const noexcept ;
(2) (C++17 起)

返回一个 std:: weak_ptr < T > ,该弱指针追踪所有指向 * this 的现有 std::shared_ptr * this 的所有权关系。

目录

返回值

weak_this

注释

功能测试 标准 功能
__cpp_lib_enable_shared_from_this 201603L (C++17) std::enable_shared_from_this::weak_from_this

示例

参见

(C++11)
具有共享对象所有权语义的智能指针
(类模板)