定义于头文件
<memory>
|
||
(1) | ||
static pointer allocate( Alloc& a, size_type n );
|
(C++11 起) (C++20 前) |
|
[[nodiscard]] static pointer allocate( Alloc& a, size_type n );
|
(C++20 起) | |
(2) | ||
static pointer allocate( Alloc& a, size_type n,
const_void_pointer hint ); |
(C++11 起) (C++20 前) |
|
[[nodiscard]] static pointer allocate( Alloc& a, size_type n,
const_void_pointer hint ); |
(C++20 起) | |
用分配器 a
分配 n*sizeof(Alloc::value_type) 字节的未初始化存储。
hint
。若可能则调用 a.allocate(n, hint) 。若不可能(例如无双参数成员函数 allocate() ),则调用 a.allocate(n)a | - | 使用的分配器 |
n | - | 要分配存储的对象数 |
hint | - | 指向临近内存位置的指针 |
调用 a.allocate(n)
所返回的指针。
分配未初始化的存储 ( std::allocator 的公开成员函数)
|