Defined in header <memory> | ||
---|---|---|
(1) | ||
static pointer allocate( Alloc& a, size_type n ); | (since C++11) (until C++20) | |
[[nodiscard]] static pointer allocate( Alloc& a, size_type n ); | (since C++20) | |
(2) | ||
static pointer allocate( Alloc& a, size_type n, const_void_pointer hint ); | (since C++11) (until C++20) | |
[[nodiscard]] static pointer allocate( Alloc& a, size_type n, const_void_pointer hint ); | (since C++20) |
Uses the allocator a
to allocate n*sizeof(Alloc::value_type)
bytes of uninitialized storage.
a.allocate(n)
hint
. Calls a.allocate(n, hint)
if possible. If not possible (e.g. a has no two-argument member function allocate()), calls a.allocate(n)
a | - | allocator to use |
n | - | the number of objects to allocate storage for |
hint | - | pointer to a nearby memory location |
The pointer returned by the call to a.allocate(n)
.
allocates uninitialized storage (public member function of std::allocator<T> ) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/memory/allocator_traits/allocate