# memory File Reference

## Detailed Description

This is a Standard C++ Library header.

Definition in file memory.

Go to the source code of this file.

## Namespaces

- namespace std

## Defines

- #define _GLIBCXX_MEMORY

## Functions

- template<typename _Tp> pair< _Tp *, ptrdiff_t > __get_temporary_buffer (ptrdiff_t __len, _Tp *)
- template<typename _Tp> pair< _Tp *, ptrdiff_t > get_temporary_buffer (ptrdiff_t __len)
- template<typename _Tp> void return_temporary_buffer (_Tp *__p)

## Function Documentation

pair<_Tp*, ptrdiff_t> std::get_temporary_buffer | ( | ptrdiff_t | __len | ) | `[inline]`

Allocates a temporary buffer.

Parameters:

  | len | The number of objects of type Tp.

Returns:
  See full description.

Reinventing the wheel, but this time with prettier spokes!

This function tries to obtain storage for `len` adjacent Tp objects. The objects themselves are not constructed, of course. A pair<> is returned containing "the buffer s address and capacity (in the units of sizeof(Tp)), or a pair of 0 values if no storage can be obtained." Note that the capacity obtained may be less than that requested if the memory is unavailable; you should compare len with the .second return value.

Provides the nothrow exception guarantee.

Definition at line 110 of file memory.

void std::return_temporary_buffer | ( | _Tp * | __p | ) |

The companion to get_temporary_buffer().

Parameters:

  | p | A buffer previously allocated by get_temporary_buffer.

Returns:
  None.

Frees the memory pointed to by p.

Definition at line 122 of file memory.