The memory block is aligned apropriately to contain elements of type T, although it is left uninitialized (no object is constructed).
This function is specifically designed to obtain memory of temporary nature (such as for the operations of an algorithm). Once the memory block is not needed anymore, it shall be released by calling return_temporary_buffer.
Parameters
- n
- Quantity of elements of type T for which temporary memory is requested.
ptrdiff_t is an integral type.
Return value
On success to obtain the storage space, the function returns a pair object with its first element containing a pointer to the first element in the block, and the second element with its size, in terms of quantity of elements of type T that it can hold.If the block cannot be obtained, the pair contains a null pointer as first and a value of zero as second.
Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
Possible output:
sorted numbers : 10 20 30 40 50 60 unsorted numbers: 30 50 10 20 60 40 |
See also
| return_temporary_buffer | Return block of temporary memory (function template) |
