|
MSTL 1.4.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
分配器特性模板 更多...
#include <allocator_traits.hpp>
Public 类型 | |
| using | const_pointer = typename real_ptr<__c_pointer, const value_type>::type |
| 常量指针类型 | |
| using | difference_type = typename real_diff<Alloc, pointer>::type |
| 指针差异类型 | |
| using | size_type = typename real_size<Alloc, difference_type>::type |
| 大小类型 | |
| template<typename T> | |
| using | rebind_alloc = alloc_rebind<Alloc, T> |
| 重新绑定分配器类型 | |
| template<typename T> | |
| using | rebind_traits = allocator_traits<rebind_alloc<T>> |
| 重新绑定分配器特性类型 | |
静态 Public 成员函数 | |
| static MSTL_NODISCARD MSTL_CONSTEXPR20 pointer | allocate (Alloc &alloc, size_type n) |
| 分配内存 | |
| static MSTL_CONSTEXPR20 void | deallocate (Alloc &alloc, pointer ptr, size_type n) |
| 释放内存 | |
| template<typename T, typename... Args> | |
| static MSTL_CONSTEXPR20 void | construct (Alloc &alloc, T *ptr, Args &&... args) noexcept(noexcept(allocator_traits::__construct_aux(alloc, ptr, _MSTL forward< Args >(args)...))) |
| 在已分配内存上构造对象 | |
| template<typename T> | |
| static MSTL_CONSTEXPR20 void | destroy (Alloc &alloc, T *ptr) noexcept(noexcept(allocator_traits::__destroy_aux(alloc, ptr, 0))) |
| 销毁对象 | |
| static MSTL_CONSTEXPR20 size_type | max_size (const Alloc &alloc) noexcept(noexcept(allocator_traits::__max_size_aux(alloc, 0))) |
| 获取分配器支持的最大大小 | |
分配器特性模板
| Alloc | 分配器类型 |
提供对分配器类型的统一访问接口,即使分配器不提供某些成员类型或函数。
主要功能:
在文件 allocator_traits.hpp 第 82 行定义.
| using allocator_traits< Alloc >::rebind_alloc = alloc_rebind<Alloc, T> |
| using allocator_traits< Alloc >::rebind_traits = allocator_traits<rebind_alloc<T>> |
|
inlinestatic |
分配内存
| alloc | 分配器对象 |
| n | 要分配的元素数量 |
在文件 allocator_traits.hpp 第 182 行定义.
被这些函数引用 allocate_guarded() , 以及 allocate_shared().
|
inlinestaticnoexcept |
在已分配内存上构造对象
| T | 要构造的对象类型 |
| Args | 构造函数参数类型 |
| alloc | 分配器对象 |
| ptr | 指向已分配内存的指针 |
| args | 构造函数参数 |
在文件 allocator_traits.hpp 第 205 行定义.
被这些函数引用 allocate_shared().
|
inlinestatic |
释放内存
| alloc | 分配器对象 |
| ptr | 要释放的内存指针 |
| n | 先前分配的元素数量 |
在文件 allocator_traits.hpp 第 192 行定义.
被这些函数引用 allocate_shared() , 以及 allocated_ptr< Alloc >::~allocated_ptr().
|
inlinestaticnoexcept |
销毁对象
| T | 要销毁的对象类型 |
| alloc | 分配器对象 |
| ptr | 指向要销毁对象的指针 |
在文件 allocator_traits.hpp 第 217 行定义.
被这些函数引用 allocate_shared().
|
inlinestaticnoexcept |