std::enable_shared_from_this<T>::weak_from_this
来自cppreference.com
< cpp | memory | enable shared from this
内存管理库
|
std::enable_shared_from_this
受保护成员函数 | ||||
公开成员函数 | ||||
enable_shared_from_this::weak_from_this (C++17) |
std::weak_ptr<T> weak_from_this() noexcept; | (1) | (C++17 起) |
std::weak_ptr<T const> weak_from_this() const noexcept; | (2) | (C++17 起) |
返回跟踪所有既存的指代 *this 的 std::shared_ptr 所拥有的 *this 的所有权的 std::weak_ptr<T>。
返回值
注解
功能特性测试宏 | 值 | 标准 | 功能特性 |
---|---|---|---|
__cpp_lib_enable_shared_from_this | 201603L | (C++17) | std::enable_shared_from_this::weak_from_this |
示例
本节未完成 原因:暂无示例 |
参阅
(C++11) | 拥有共享对象所有权语义的智能指针 (类模板) |