---
name: "__gnu_cxx::temporary_buffer"
section: "3"
platform: "linux"
package: "gcc"
version: "16.2.1+r23+gd564253eb6c8-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/__gnu_cxx::temporary_buffer"
---

# \_\_gnu\_cxx::temporary\_buffer(3)

## NAME

\_\_gnu\_cxx::temporary\_buffer\< \_ForwardIterator, \_Tp \>

## SYNOPSIS

\#include \<memory\>

Inherits **std::\_Temporary\_buffer\< \_ForwardIterator, \_Tp \>**.

### Public Types

typedef pointer **iterator**\
 typedef value\_type \* **pointer**\
 typedef ptrdiff\_t **size\_type**\
 typedef \_Tp **value\_type**\

### Public Member Functions

**temporary\_buffer** (\_ForwardIterator \_\_first, \_ForwardIterator \_\_last)\
 Requests storage large enough to hold a copy of \[first,last).  **~temporary\_buffer** ()\
 Destroys objects and frees storage.  size\_type **\_M\_requested\_size** () const\
 Returns the size requested by the constructor; may be \>size().  iterator **begin** ()\
 As per Table mumble.  iterator **end** ()\
 As per Table mumble.  size\_type **size** () const\
 As per Table mumble.

### Protected Attributes

struct std::\_Temporary\_buffer::\_Impl **\_M\_impl**\
 size\_type **\_M\_original\_len**\

## Detailed Description

### template\<class \_ForwardIterator, class \_Tp = typename std::iterator\_traits\<\_ForwardIterator\>::value\_type\>

struct \_\_gnu\_cxx::temporary\_buffer\< \_ForwardIterator, \_Tp \>"This class provides similar behavior and semantics of the standard functions get\_temporary\_buffer() and return\_temporary\_buffer(), but encapsulated in a type vaguely resembling a standard container.

By default, a temporary\_buffer\<Iter\> stores space for objects of whatever type the Iter iterator points to. It is constructed from a typical \[first,last) range, and provides the begin(), end(), size() functions, as well as requested\_size(). For non-trivial types, copies of \*first will be used to initialize the storage.

malloc is used to obtain underlying storage.

Like get\_temporary\_buffer(), not all the requested memory may be available. Ideally, the created buffer will be large enough to hold a copy of \[first,last), but if size() is less than requested\_size(), then this didn't happen.

## Constructor & Destructor Documentation

### template\<class \_ForwardIterator, class \_Tp = typename std::iterator\_traits\<\_ForwardIterator\>::value\_type\> \_\_gnu\_cxx::temporary\_buffer\< \_ForwardIterator, \_Tp \>::temporary\_buffer (\_ForwardIterator \_\_first, \_ForwardIterator \_\_last) \[inline\]

Requests storage large enough to hold a copy of \[first,last).

References **std::\_Temporary\_buffer\< \_ForwardIterator, \_Tp \>::\_Temporary\_buffer()**, and **\_\_gnu\_cxx::distance()**.

### template\<class \_ForwardIterator, class \_Tp = typename std::iterator\_traits\<\_ForwardIterator\>::value\_type\> \_\_gnu\_cxx::temporary\_buffer\< \_ForwardIterator, \_Tp \>::~temporary\_buffer () \[inline\]

Destroys objects and frees storage.

## Member Function Documentation

### template\<typename \_ForwardIterator, typename \_Tp\> size\_type std::\_Temporary\_buffer\< \_ForwardIterator, \_Tp \>::\_M\_requested\_size () const \[inline\], \[inherited\]

Returns the size requested by the constructor; may be \>size().

### template\<typename \_ForwardIterator, typename \_Tp\> iterator std::\_Temporary\_buffer\< \_ForwardIterator, \_Tp \>::begin () \[inline\], \[inherited\]

As per Table mumble.

Referenced by **\_Temporary\_buffer()**.

### template\<typename \_ForwardIterator, typename \_Tp\> iterator std::\_Temporary\_buffer\< \_ForwardIterator, \_Tp \>::end () \[inline\], \[inherited\]

As per Table mumble.

Referenced by **\_Temporary\_buffer()**.

### template\<typename \_ForwardIterator, typename \_Tp\> size\_type std::\_Temporary\_buffer\< \_ForwardIterator, \_Tp \>::size () const \[inline\], \[inherited\]

As per Table mumble.

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
