# __gnu_cxx::temporary_buffer< _ForwardIterator, _Tp > Struct Template Reference
[STL extensions from SGI]

List of all members.

## 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.
ptrdiff_t | size () const
| As per Table mumble.
ptrdiff_t | requested_size () const
| Returns the size requested by the constructor; may be >size().
_Tp * | begin ()
| As per Table mumble.
_Tp * | end ()
| As per Table mumble.

## 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.

Definition at line 158 of file ext/memory.

## 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). Definition at line 161 of file ext/memory.

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. Definition at line 164 of file ext/memory.

## Member Function Documentation

template<class _ForwardIterator, class _Tp>
_Tp* std::_Temporary_buffer< _ForwardIterator, _Tp >::begin | ( |  | ) | `[inline, inherited]`

| As per Table mumble. Definition at line 111 of file stl_tempbuf.h.

template<class _ForwardIterator, class _Tp>
_Tp* std::_Temporary_buffer< _ForwardIterator, _Tp >::end | ( |  | ) | `[inline, inherited]`

| As per Table mumble. Definition at line 113 of file stl_tempbuf.h.

template<class _ForwardIterator, class _Tp>
ptrdiff_t std::_Temporary_buffer< _ForwardIterator, _Tp >::requested_size | ( |  | ) | const`[inline, inherited]`

| Returns the size requested by the constructor; may be >size(). Definition at line 109 of file stl_tempbuf.h.

template<class _ForwardIterator, class _Tp>
ptrdiff_t std::_Temporary_buffer< _ForwardIterator, _Tp >::size | ( |  | ) | const`[inline, inherited]`

| As per Table mumble. Definition at line 107 of file stl_tempbuf.h.

The documentation for this struct was generated from the following file:

- ext/memory