std::enable_shared_from_this<T>::weak_from_this
來自 cppreference.com
< cpp | memory | enable shared from this
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 的所有權。
目錄 |
[編輯] 返回值
[編輯] 注意
特性測試宏 | 值 | 標準 | 特性 |
---|---|---|---|
__cpp_lib_enable_shared_from_this |
201603L |
(C++17) | std::enable_shared_from_this::weak_from_this
|
[編輯] 示例
本節不完整 原因:無示例 |
[編輯] 參閱
(C++11) |
具有共享物件所有權語義的智慧指標 (類模板) |