Library: General utilities
Function
Function template for efficient allocation of temporary storage.
#include <memory> namespace std { template <class T> pair<T*, ptrdiff_t> get_temporary_buffer(ptrdiff_t); }
Specializations of the get_temporary_buffer() function template attempt to allocate a region of storage sufficiently large to store at least n adjacent objects of type T.
On success, the function returns a pair containing the beginning address of the allocated but uninitialized region of storage and its size in units of sizeof(T)). On failure, the function returns a pair of 0 values.
It is not specified how the storage is allocated, however, it can be assumed that the function is at least as efficient as allocating the storage dynamically, for example, by calling operator new.
The function is thread-safe but the allocated storage must be returned by a call to return_temporary_buffer() made from the same thread as the one that obtained it.
allocator, pair, return_temporary_buffer()
ISO/IEC 14882:1998 -- International Standard for Information Systems -- Programming Language C++, Section 20.4.3