std::get_temporary_buffer (3) - Linux Manuals
std::get_temporary_buffer: std::get_temporary_buffer
NAME
std::get_temporary_buffer - std::get_temporary_buffer
Synopsis
Defined in header <memory>
template< class T > (deprecated in C++17)
std::pair< T*, std::ptrdiff_t > get_temporary_buffer( std::ptrdiff_t count ); (removed in C++20)
Allocates uninitialized contiguous storage, which should be sufficient to store up to count adjacent objects of type T. The request is non-binding and the implementation may allocate less or more than necessary to store count adjacent objects.
Parameters
count - the desired number of objects
Return value
An std::pair holding a pointer to the beginning of the allocated storage and the number of objects that fit in the storage that was actually allocated.
If no memory could be allocated, or allocated storage is not enough to store a single element of type T, the first element of the result is a null pointer and the second element is zero.
Exceptions
(none) (until C++11)
noexcept specification: (since C++11)
noexcept
Example
// Run this code
Output:
See also
return_temporary_buffer frees uninitialized storage
(deprecated in C++17)
(removed in C++20)