MPD 0.20.6

- Main Page
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

Public Member Functions
ReusableArray< T, M > Class Template Reference

Manager for a temporary array which grows as needed. More...

`#include <ReusableArray.hxx>`

## Public Member Functions
| ReusableArray ()=default
| ReusableArray (ReusableArray &&src)
ReusableArray & | operator= (ReusableArray &&src)
| ~ReusableArray ()
size_t | GetCapacity () const
void | Clear ()
| Free resources allocated by this object. More...
gcc_malloc T * | Get (size_t size)
| Get the buffer, and guarantee a minimum size. More...

## Detailed Description

### template<typename T, size_t M = 1>
class ReusableArray< T, M >

Manager for a temporary array which grows as needed.

This attempts to reduce the number of consecutive heap allocations and deallocations.

Parameters

  T | the array element type
  M | always allocate multiples of this number; must be a power of 2

Definition at line 48 of file ReusableArray.hxx.

## Constructor & Destructor Documentation

template<typename T, size_t M = 1>

ReusableArray< T, M >::ReusableArray | ( |  | ) |
| default

template<typename T, size_t M = 1>

ReusableArray< T, M >::ReusableArray | ( | ReusableArray< T, M > && | src | ) |
| inline

Definition at line 55 of file ReusableArray.hxx.

template<typename T, size_t M = 1>

ReusableArray< T, M >::~ReusableArray | ( |  | ) |
| inline

Definition at line 65 of file ReusableArray.hxx.

## Member Function Documentation

template<typename T, size_t M = 1>

void ReusableArray< T, M >::Clear | ( |  | ) |
| inline

Free resources allocated by this object.

This invalidates the buffer returned by Get().

Definition at line 77 of file ReusableArray.hxx.

template<typename T, size_t M = 1>

gcc_malloc T* ReusableArray< T, M >::Get | ( | size_t | size | ) |
| inline

Get the buffer, and guarantee a minimum size.

This buffer becomes invalid with the next Get() call.

Definition at line 88 of file ReusableArray.hxx.

template<typename T, size_t M = 1>

size_t ReusableArray< T, M >::GetCapacity | ( |  | ) | const
| inline

Definition at line 69 of file ReusableArray.hxx.

template<typename T, size_t M = 1>

ReusableArray& ReusableArray< T, M >::operator= | ( | ReusableArray< T, M > && | src | ) |
| inline

Definition at line 59 of file ReusableArray.hxx.

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

- util/ReusableArray.hxx