在线文档教程
C++
动态内存管理 | Dynamic memory management

std::allocator_traits::allocate

STD::分配器[医]特点::分配

Defined in header
static pointer allocate( Alloc& a, size_type n (1)(since C++11)
static pointer allocate( Alloc& a, size_type n, const_void_pointer hint (2)(since C++11)

使用分配器a分配n*sizeof(Alloc::value_type)未初始化存储的字节。

1%29次电话a.allocate(n)

2%29附加传递内存局部性提示hint.电话a.allocate(n, hint)如果可能的话。如果不可能的话,%28例如。a没有双参数成员函数分配%28%29%29,调用a.allocate(n)

参数

a-allocator to use
n-the number of objects to allocate storage for
hint-pointer to a nearby memory location

返回值

调用返回的指针。a.allocate(n)...

另见

allocateallocates uninitialized storage (public member function of std::allocator)

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/Memory/allocator[医]性状/分配