|
MSTL 1.4.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
标准分配器类 更多...
#include <standard_allocator.hpp>
类 | |
| struct | rebind |
| 重新绑定模板 更多... | |
Public 类型 | |
| using | value_type = T |
| 元素类型 | |
| using | pointer = T* |
| 指针类型 | |
| using | size_type = _INNER alloc_size_t |
| 大小类型 | |
Public 成员函数 | |
| MSTL_CONSTEXPR20 | standard_allocator () noexcept=default |
| 默认构造函数 | |
| template<typename U> | |
| MSTL_CONSTEXPR20 | standard_allocator (const standard_allocator< U > &) noexcept |
| 从其他分配器类型转换构造 | |
| MSTL_CONSTEXPR20 | ~standard_allocator () noexcept=default |
| 析构函数 | |
| MSTL_CONSTEXPR20 standard_allocator & | operator= (const standard_allocator &) noexcept=default |
| 赋值运算符 | |
静态 Public 成员函数 | |
| MSTL_ALLOC_NODISCARD MSTL_CONSTEXPR20 static MSTL_ALLOC_OPTIMIZE pointer | allocate (const size_type n) |
| 分配指定数量的元素内存 | |
| MSTL_ALLOC_NODISCARD MSTL_CONSTEXPR20 static MSTL_ALLOC_OPTIMIZE pointer | allocate () |
| 分配单个元素内存 | |
| static MSTL_CONSTEXPR20 void | deallocate (pointer p, const size_type n) noexcept |
| 释放先前分配的内存 | |
| static MSTL_CONSTEXPR20 void | deallocate (pointer p) noexcept |
| 释放单个元素内存 | |
标准分配器类
| T | 要分配的元素类型 |
提供类型安全的内存分配和释放,支持对齐优化。
在文件 standard_allocator.hpp 第 315 行定义.
|
inlinenoexcept |
|
inlinestatic |
分配单个元素内存
| allocate_exception | 如果内存分配失败 |
在文件 standard_allocator.hpp 第 382 行定义.
被这些函数引用 standard_allocator< U >::allocate().
|
inlinestatic |
分配指定数量的元素内存
| n | 要分配的元素数量 |
| allocate_exception | 如果内存分配失败 |
分配 n 个 T 类型的连续内存空间。
在文件 standard_allocator.hpp 第 364 行定义.
|
inlinestaticnoexcept |
|
inlinestaticnoexcept |
释放先前分配的内存
| p | 要释放的内存指针 |
| n | 先前分配的元素数量 |
在文件 standard_allocator.hpp 第 392 行定义.