|
| | weak_ptr (nullptr_t np=nullptr) noexcept |
| | 默认构造函数
|
| template<typename U, enable_if_t< is_convertible_v< U *, T * >, int > = 0> |
| | weak_ptr (const shared_ptr< U > &sp) noexcept |
| | 共享智能指针构造函数
|
| | weak_ptr (const weak_ptr &wp) noexcept |
| | 拷贝构造函数
|
| template<typename U, enable_if_t< is_convertible_v< U *, T * >, int > = 0> |
| | weak_ptr (const weak_ptr< U > &wp) noexcept |
| | 类型转换拷贝构造函数
|
| | weak_ptr (weak_ptr &&wp) noexcept |
| | 移动构造函数
|
| template<typename U, enable_if_t< is_convertible_v< U *, T * >, int > = 0> |
| | weak_ptr (weak_ptr< U > &&wp) noexcept |
| | 类型转换移动构造函数
|
| | ~weak_ptr () |
| | 析构函数
|
| weak_ptr & | operator= (const weak_ptr &wp) noexcept |
| | 拷贝赋值运算符
|
| template<typename U, enable_if_t< is_convertible_v< U *, T * >, int > = 0> |
| weak_ptr & | operator= (const weak_ptr< U > &wp) noexcept |
| | 类型转换拷贝赋值运算符
|
| template<typename U, enable_if_t< is_convertible_v< U *, T * >, int > = 0> |
| weak_ptr & | operator= (const shared_ptr< U > &sp) noexcept |
| | 共享智能指针赋值运算符
|
| weak_ptr & | operator= (weak_ptr &&wp) noexcept |
| | 移动赋值运算符
|
| template<typename U, enable_if_t< is_convertible_v< U *, T * >, int > = 0> |
| weak_ptr & | operator= (weak_ptr< U > &&wp) noexcept |
| | 类型转换移动赋值运算符
|
| void | reset () noexcept |
| | 重置弱指针
|
| void | swap (weak_ptr &wp) noexcept |
| | 交换两个弱指针
|
| MSTL_NODISCARD long | use_count () const noexcept |
| | 获取观察对象的引用计数
|
| MSTL_NODISCARD bool | expired () const noexcept |
| | 检查观察的对象是否已被销毁
|
| MSTL_NODISCARD shared_ptr< T > | lock () const noexcept |
| | 尝试获取共享智能指针
|
| template<typename U> |
| MSTL_NODISCARD bool | owner_equal (const weak_ptr< U > &rhs) const noexcept |
| | 检查所有权是否相等
|
| template<typename U> |
| MSTL_NODISCARD bool | owner_equal (const shared_ptr< U > &rhs) const noexcept |
| | 与共享指针检查所有权是否相等
|
| template<typename U> |
| MSTL_NODISCARD bool | owner_before (const weak_ptr< U > &rhs) const noexcept |
| | 比较所有权顺序
|
| template<typename U> |
| MSTL_NODISCARD bool | owner_before (const shared_ptr< U > &rhs) const noexcept |
| | 与共享指针比较所有权顺序
|
template<typename T>
class weak_ptr< T >
弱智能指针类模板
- 模板参数
-
弱智能指针用于观察由共享智能指针管理的对象,但不拥有对象的所有权。 不会增加对象的引用计数,因此不会阻止对象被销毁。
在文件 weak_ptr.hpp 第 30 行定义.