|
NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
共享智能指针类和辅助工具 更多...
类 | |
| struct | enable_shared_from_this< T > |
| 启用从this创建共享指针的基类 更多... | |
| class | shared_ptr< T > |
| 共享智能指针类模板 更多... | |
| class | weak_ptr< T > |
| 弱智能指针类模板 更多... | |
| class | shared_ptr< T[]> |
| 数组特化的共享指针 更多... | |
| struct | is_shared_ptr< T > |
| 类型特征:是否为shared_ptr 更多... | |
函数 | |
| template<typename T, typename U> | |
| NEFORCE_NODISCARD bool | operator== (const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) noexcept |
| 相等比较运算符 | |
| template<typename T, typename U> | |
| NEFORCE_NODISCARD bool | operator!= (const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) noexcept |
| 不等比较运算符 | |
| template<typename T, typename U> | |
| NEFORCE_NODISCARD bool | operator< (const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) noexcept |
| 小于比较运算符(基于所有权顺序) | |
| template<typename T, typename U> | |
| NEFORCE_NODISCARD bool | operator> (const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) noexcept |
| 大于比较运算符 | |
| template<typename T, typename U> | |
| NEFORCE_NODISCARD bool | operator<= (const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) noexcept |
| 小于等于比较运算符 | |
| template<typename T, typename U> | |
| NEFORCE_NODISCARD bool | operator>= (const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) noexcept |
| 大于等于比较运算符 | |
| template<typename T, typename... Args> | |
| enable_if_t<!is_unbounded_array_v< T > &&is_constructible_v< T, Args... >, shared_ptr< T > > | make_shared (Args &&... args) |
| 融合分配创建共享指针 | |
| template<typename T> | |
| enable_if_t< is_unbounded_array_v< T >, shared_ptr< T > > | make_shared (const size_t len) |
| 创建动态数组的共享指针 | |
| template<typename T, typename Alloc, typename... Args> | |
| enable_if_t<!is_array_v< T > &&is_constructible_v< T, Args... >, shared_ptr< T > > | allocate_shared (Alloc &alloc, Args &&... args) |
| 使用分配器创建共享指针 | |
| template<typename T, typename U> | |
| shared_ptr< T > | static_pointer_cast (const shared_ptr< U > &ptr) |
| 静态类型转换 | |
| template<typename T, typename U> | |
| shared_ptr< T > | const_pointer_cast (const shared_ptr< U > &ptr) |
| CV类型转换 | |
| template<typename T, typename U> | |
| shared_ptr< T > | reinterpret_pointer_cast (const shared_ptr< U > &ptr) |
| 重解释类型转换 | |
| template<typename T, typename U> | |
| shared_ptr< T > | dynamic_pointer_cast (const shared_ptr< U > &ptr) |
| 动态类型转换 | |
共享智能指针类和辅助工具
| enable_if_t<!is_array_v< T > &&is_constructible_v< T, Args... >, shared_ptr< T > > allocate_shared | ( | Alloc & | alloc, |
| Args &&... | args ) |
使用分配器创建共享指针
| T | 对象类型 |
| Alloc | 分配器类型 |
| Args | 参数类型 |
| alloc | 分配器 |
| args | 构造参数 |
| memory_exception | 如果构造对象或控制块时抛出错误 |
使用自定义分配器分配控制块和对象的内存。
在文件 shared_ptr.hpp 第 853 行定义.
引用了 allocator_traits< Alloc >::allocate(), allocator_traits< Alloc >::construct(), construct(), allocator_traits< Alloc >::deallocate(), allocator_traits< Alloc >::destroy(), forward(), is_constructible_v , 以及 max().
| shared_ptr< T > const_pointer_cast | ( | const shared_ptr< U > & | ptr | ) |
| shared_ptr< T > dynamic_pointer_cast | ( | const shared_ptr< U > & | ptr | ) |
| enable_if_t<!is_unbounded_array_v< T > &&is_constructible_v< T, Args... >, shared_ptr< T > > make_shared | ( | Args &&... | args | ) |
融合分配创建共享指针
| T | 对象类型 |
| Args | 参数类型 |
| args | 构造参数 |
| memory_exception | 如果构造对象时抛出错误 |
在单块内存中同时分配控制块和对象,提高内存局部性和性能。
在文件 shared_ptr.hpp 第 789 行定义.
引用了 construct(), forward(), is_constructible_v, is_nothrow_destructible_v, max(), move() , 以及 size().
被这些函数引用 async(), connection::connection(), get_current_task_group(), path_tree::path_tree(), promise< Res >::promise(), promise< Res & >::promise() , 以及 promise< void >::promise().
| enable_if_t< is_unbounded_array_v< T >, shared_ptr< T > > make_shared | ( | const size_t | len | ) |
创建动态数组的共享指针
| T | 数组类型 |
| len | 数组长度 |
| memory_exception | 如果构造对象时抛出错误 |
在文件 shared_ptr.hpp 第 827 行定义.
引用了 unreachable().
| shared_ptr< T > reinterpret_pointer_cast | ( | const shared_ptr< U > & | ptr | ) |
| shared_ptr< T > static_pointer_cast | ( | const shared_ptr< U > & | ptr | ) |