命名空间
变体
操作

std::experimental::weak_ptr

来自 cppreference.cn
 
 
实验性
技术规范
文件系统库 (filesystem TS)
库基础 (library fundamentals TS)
库基础 2 (library fundamentals TS v2)
库基础 3 (library fundamentals TS v3)
并行扩展 (parallelism TS)
并行扩展 2 (parallelism TS v2)
并发扩展 (concurrency TS)
并发扩展 2 (concurrency TS v2)
概念 (concepts TS)
范围 (ranges TS)
反射 (reflection TS)
数学特殊函数 (special functions TR)
实验性非 TS
模式匹配
线性代数
std::execution
契约
2D 图形
 
 
 
定义于头文件 <experimental/memory>
template< class T > class weak_ptr;
(library fundamentals TS)

std::experimental::weak_ptrstd::weak_ptr 的修改版本,它可以与 std::experimental::shared_ptr 互操作,并支持数组。

目录

[编辑] 成员类型

成员类型 定义
element_type std::remove_extent_t<T>

[编辑] 成员函数

构造新的 weak_ptr
(公共成员函数) [编辑]

std::weak_ptr 相同的成员和非成员

成员函数

以下成员函数使用 std::experimental::shared_ptr 而不是 std::shared_ptr,以及 std::experimental::weak_ptr 而不是 std::weak_ptr。除此之外,行为是相同的。

销毁 weak_ptr
(std::weak_ptr<T> 的公共成员函数) [编辑]
赋值 weak_ptr
(std::weak_ptr<T> 的公共成员函数) [编辑]
修改器
释放对被管理对象的所有权
(std::weak_ptr<T> 的公共成员函数) [编辑]
交换被管理对象
(std::weak_ptr<T> 的公共成员函数) [编辑]
观察器
返回管理该对象的 shared_ptr 对象的数量
(std::weak_ptr<T> 的公共成员函数) [编辑]
检查引用的对象是否已被删除
(std::weak_ptr<T> 的公共成员函数) [编辑]
创建一个管理被引用对象的 shared_ptr
(std::weak_ptr<T> 的公共成员函数) [编辑]
提供基于所有者的弱指针排序
(std::weak_ptr<T> 的公共成员函数) [编辑]

非成员函数

此非成员函数在 std::experimental 命名空间中声明,并与 std::experimental::weak_ptr 而不是 std::weak_ptr 一起使用,但在其他方面行为与相应的 C++14 函数相同。

特化 std::swap 算法
(函数模板) [编辑]

[编辑] 示例