|
NexusForce 1.0.0
A rigorously engineered full-stack C++ backend library.
|
共享智能指针类和辅助工具 更多...
类 | |
| struct | neforce::enable_shared_from_this< T > |
| 启用从this创建共享指针的基类 更多... | |
| class | neforce::shared_ptr< T > |
| 共享智能指针类模板 更多... | |
| class | neforce::weak_ptr< T > |
| 弱智能指针类模板 更多... | |
| class | neforce::shared_ptr< T[]> |
| 数组特化的共享指针 更多... | |
| struct | neforce::is_shared_ptr< T > |
| 类型特征:是否为shared_ptr 更多... | |
函数 | |
| template<typename T, typename U> | |
| bool | neforce::operator== (const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) noexcept |
| 相等比较运算符 | |
| template<typename T, typename U> | |
| bool | neforce::operator!= (const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) noexcept |
| 不等比较运算符 | |
| template<typename T, typename U> | |
| bool | neforce::operator< (const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) noexcept |
| 小于比较运算符(基于所有权顺序) | |
| template<typename T, typename U> | |
| bool | neforce::operator> (const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) noexcept |
| 大于比较运算符 | |
| template<typename T, typename U> | |
| bool | neforce::operator<= (const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) noexcept |
| 小于等于比较运算符 | |
| template<typename T, typename U> | |
| bool | neforce::operator>= (const shared_ptr< T > &lhs, const shared_ptr< U > &rhs) noexcept |
| 大于等于比较运算符 | |
| template<typename T> | |
| bool | neforce::operator== (const shared_ptr< T > &lhs, nullptr_t np) noexcept |
| 与nullptr相等比较 | |
| template<typename T> | |
| bool | neforce::operator== (nullptr_t np, const shared_ptr< T > &rhs) noexcept |
| nullptr与共享指针相等比较 | |
| template<typename T> | |
| bool | neforce::operator!= (const shared_ptr< T > &lhs, nullptr_t np) noexcept |
| 与nullptr不等比较 | |
| template<typename T> | |
| bool | neforce::operator!= (nullptr_t np, const shared_ptr< T > &rhs) noexcept |
| nullptr与共享指针不等比较 | |
| template<typename T, typename... Args> | |
| enable_if_t<!is_unbounded_array_v< T > &&is_constructible_v< T, Args... >, shared_ptr< T > > | neforce::make_shared (Args &&... args) |
| 融合分配创建共享指针 | |
| template<typename T> | |
| enable_if_t< is_unbounded_array_v< T >, shared_ptr< T > > | neforce::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 > > | neforce::allocate_shared (Alloc &alloc, Args &&... args) |
| 使用分配器创建共享指针 | |
| template<typename T, typename U> | |
| shared_ptr< T > | neforce::static_pointer_cast (const shared_ptr< U > &ptr) |
| 静态类型转换 | |
| template<typename T, typename U> | |
| shared_ptr< T > | neforce::const_pointer_cast (const shared_ptr< U > &ptr) |
| CV类型转换 | |
| template<typename T, typename U> | |
| shared_ptr< T > | neforce::reinterpret_pointer_cast (const shared_ptr< U > &ptr) |
| 重解释类型转换 | |
| template<typename T, typename U> | |
| shared_ptr< T > | neforce::dynamic_pointer_cast (const shared_ptr< U > &ptr) |
| 动态类型转换 | |
共享智能指针类和辅助工具
| enable_if_t<!is_array_v< T > &&is_constructible_v< T, Args... >, shared_ptr< T > > neforce::allocate_shared | ( | Alloc & | alloc, |
| Args &&... | args ) |
使用分配器创建共享指针
| T | 对象类型 |
| Alloc | 分配器类型 |
| Args | 参数类型 |
| alloc | 分配器 |
| args | 构造参数 |
| memory_exception | 如果构造对象或控制块时抛出错误 |
使用自定义分配器分配控制块和对象的内存。
在文件 shared_ptr.hpp 第 913 行定义.
引用了 neforce::allocator_traits< Alloc >::allocate(), allocate_shared(), neforce::allocator_traits< Alloc >::construct(), construct(), neforce::allocator_traits< Alloc >::deallocate(), neforce::allocator_traits< Alloc >::destroy(), forward(), is_constructible_v , 以及 max().
被这些函数引用 allocate_shared().
| shared_ptr< T > neforce::const_pointer_cast | ( | const shared_ptr< U > & | ptr | ) |
CV类型转换
| T | 目标类型 |
| U | 源类型 |
| ptr | 源共享指针 |
在文件 shared_ptr.hpp 第 976 行定义.
引用了 const_pointer_cast() , 以及 neforce::shared_ptr< T >::get().
被这些函数引用 const_pointer_cast(), const_pointer_cast() , 以及 const_pointer_cast().
| shared_ptr< T > neforce::dynamic_pointer_cast | ( | const shared_ptr< U > & | ptr | ) |
动态类型转换
| T | 目标类型 |
| U | 源类型 |
| ptr | 源共享指针 |
在文件 shared_ptr.hpp 第 1000 行定义.
引用了 dynamic_pointer_cast() , 以及 neforce::shared_ptr< T >::get().
被这些函数引用 dynamic_pointer_cast(), dynamic_pointer_cast() , 以及 dynamic_pointer_cast().
| enable_if_t<!is_unbounded_array_v< T > &&is_constructible_v< T, Args... >, shared_ptr< T > > neforce::make_shared | ( | Args &&... | args | ) |
融合分配创建共享指针
| T | 对象类型 |
| Args | 参数类型 |
| args | 构造参数 |
| memory_exception | 如果构造对象时抛出错误 |
在单块内存中同时分配控制块和对象,提高内存局部性和性能。
在文件 shared_ptr.hpp 第 849 行定义.
引用了 construct(), forward(), is_constructible_v, is_nothrow_destructible_v, make_shared(), max(), move() , 以及 size().
被这些函数引用 neforce::timer_scheduler< Clock >::add_task(), neforce::cancellation_slot::assign(), async(), neforce::awaitable< void >::awaitable(), neforce::connection::connection(), neforce::tui::component< P >::create_state(), neforce::executor::executor(), get_current_task_group(), make_shared(), make_shared(), neforce::path_tree::path_tree(), neforce::promise< Res >::promise(), neforce::promise< Res & >::promise(), neforce::promise< void >::promise(), neforce::tui::component_base::provide_context(), neforce::strand::strand(), neforce::yaml_builder::value(), neforce::yaml_builder::value(), neforce::yaml_builder::value(), neforce::yaml_builder::value(), neforce::yaml_builder::value() , 以及 neforce::yaml_builder::value().
| enable_if_t< is_unbounded_array_v< T >, shared_ptr< T > > neforce::make_shared | ( | const size_t | len | ) |
创建动态数组的共享指针
| T | 数组类型 |
| len | 数组长度 |
| memory_exception | 如果构造对象时抛出错误 |
在文件 shared_ptr.hpp 第 887 行定义.
引用了 make_shared() , 以及 unreachable().
|
nodiscardnoexcept |
|
nodiscardnoexcept |
|
nodiscardnoexcept |
|
nodiscardnoexcept |
| shared_ptr< T > neforce::reinterpret_pointer_cast | ( | const shared_ptr< U > & | ptr | ) |
重解释类型转换
| T | 目标类型 |
| U | 源类型 |
| ptr | 源共享指针 |
在文件 shared_ptr.hpp 第 988 行定义.
引用了 neforce::shared_ptr< T >::get() , 以及 reinterpret_pointer_cast().
被这些函数引用 reinterpret_pointer_cast(), reinterpret_pointer_cast() , 以及 reinterpret_pointer_cast().
| shared_ptr< T > neforce::static_pointer_cast | ( | const shared_ptr< U > & | ptr | ) |
静态类型转换
| T | 目标类型 |
| U | 源类型 |
| ptr | 源共享指针 |
在文件 shared_ptr.hpp 第 964 行定义.
引用了 neforce::shared_ptr< T >::get() , 以及 static_pointer_cast().
被这些函数引用 static_pointer_cast(), static_pointer_cast() , 以及 static_pointer_cast().