std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>::allocate

From cppreference.com
 
 
Dynamic memory management
Smart pointers
(C++11)
(C++11)
(C++11)
(until C++17)
(C++11)
(C++23)
Allocators
Memory resources
Uninitialized storage
Uninitialized memory algorithms
Constrained uninitialized memory algorithms
Garbage collection support
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
Miscellaneous
(C++20)
(C++11)
(C++11)
 
 
Defined in header <scoped_allocator>
(1)
pointer allocate( size_type n );
(since C++11)
(until C++20)
[[nodiscard]] pointer allocate( size_type n );
(since C++20)
(2)
pointer allocate( size_type n, const_void_pointer hint );
(since C++11)
(until C++20)
[[nodiscard]] pointer allocate( size_type n, const_void_pointer hint );
(since C++20)

Uses the outer allocator to allocate uninitialized storage.

1) Calls std::allocator_traits<OuterAlloc>::allocate(outer_allocator(), n)
2) Additionally provides memory locality hint, by calling std::allocator_traits<OuterAlloc>::allocate(outer_allocator(), n, hint)

Parameters

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

Return value

The pointer to the allocated storage

See also

allocates uninitialized storage
(public member function of std::allocator<T>)
[static]
allocates uninitialized storage using the allocator
(public static member function of std::allocator_traits<Alloc>)