MPD  0.20.6
Public Types | Public Member Functions | Protected Attributes
AllocatedArray< T > Class Template Reference

An array allocated on the heap with a length determined at runtime. More...

#include <Util.hxx>

Collaboration diagram for AllocatedArray< T >:
[legend]

Public Types

typedef Buffer::size_type size_type
 
typedef Buffer::reference_type reference_type
 
typedef Buffer::const_reference_type const_reference_type
 
typedef Buffer::iterator iterator
 
typedef Buffer::const_iterator const_iterator
 

Public Member Functions

constexpr AllocatedArray ()=default
 
 AllocatedArray (size_type _size)
 
 AllocatedArray (const AllocatedArray &other)
 
 AllocatedArray (AllocatedArray &&other)
 
 ~AllocatedArray ()
 
AllocatedArrayoperator= (const AllocatedArray &other)
 
AllocatedArrayoperator= (AllocatedArray &&other)
 
constexpr bool IsNull () const
 
constexpr bool empty () const
 Returns true if no memory was allocated so far. More...
 
constexpr size_type size () const
 Returns the number of allocated elements. More...
 
reference_type front ()
 
const_reference_type front () const
 
reference_type back ()
 
const_reference_type back () const
 
reference_type operator[] (size_type i)
 Returns one element. More...
 
const_reference_type operator[] (size_type i) const
 Returns one constant element. More...
 
iterator begin ()
 
constexpr const_iterator begin () const
 
iterator end ()
 
constexpr const_iterator end () const
 
void ResizeDiscard (size_type _size)
 Resizes the array, discarding old data. More...
 
void GrowDiscard (size_type _size)
 Grows the array to the specified size, discarding old data. More...
 
void GrowPreserve (size_type _size, size_type preserve)
 Grows the array to the specified size, preserving the value of a range of elements, starting from the beginning. More...
 
void SetSize (size_type _size)
 Declare that the buffer has the specified size. More...
 

Protected Attributes

Buffer buffer nullptr
 

Detailed Description

template<class T>
class AllocatedArray< T >

An array allocated on the heap with a length determined at runtime.

Definition at line 28 of file Util.hxx.

Member Typedef Documentation

template<class T>
typedef Buffer::const_iterator AllocatedArray< T >::const_iterator

Definition at line 52 of file AllocatedArray.hxx.

Definition at line 50 of file AllocatedArray.hxx.

template<class T>
typedef Buffer::iterator AllocatedArray< T >::iterator

Definition at line 51 of file AllocatedArray.hxx.

template<class T>
typedef Buffer::reference_type AllocatedArray< T >::reference_type

Definition at line 49 of file AllocatedArray.hxx.

template<class T>
typedef Buffer::size_type AllocatedArray< T >::size_type

Definition at line 48 of file AllocatedArray.hxx.

Constructor & Destructor Documentation

template<class T>
constexpr AllocatedArray< T >::AllocatedArray ( )
default
template<class T>
AllocatedArray< T >::AllocatedArray ( size_type  _size)
inlineexplicit

Definition at line 60 of file AllocatedArray.hxx.

template<class T>
AllocatedArray< T >::AllocatedArray ( const AllocatedArray< T > &  other)
inlineexplicit

Definition at line 65 of file AllocatedArray.hxx.

template<class T>
AllocatedArray< T >::AllocatedArray ( AllocatedArray< T > &&  other)
inline

Definition at line 73 of file AllocatedArray.hxx.

template<class T>
AllocatedArray< T >::~AllocatedArray ( )
inline

Definition at line 78 of file AllocatedArray.hxx.

Member Function Documentation

template<class T>
reference_type AllocatedArray< T >::back ( )
inline

Definition at line 125 of file AllocatedArray.hxx.

template<class T>
const_reference_type AllocatedArray< T >::back ( ) const
inline

Definition at line 129 of file AllocatedArray.hxx.

template<class T>
iterator AllocatedArray< T >::begin ( )
inline

Definition at line 151 of file AllocatedArray.hxx.

template<class T>
constexpr const_iterator AllocatedArray< T >::begin ( ) const
inline

Definition at line 155 of file AllocatedArray.hxx.

template<class T>
constexpr bool AllocatedArray< T >::empty ( ) const
inline

Returns true if no memory was allocated so far.

Definition at line 106 of file AllocatedArray.hxx.

template<class T>
iterator AllocatedArray< T >::end ( )
inline

Definition at line 159 of file AllocatedArray.hxx.

template<class T>
constexpr const_iterator AllocatedArray< T >::end ( ) const
inline

Definition at line 163 of file AllocatedArray.hxx.

template<class T>
reference_type AllocatedArray< T >::front ( )
inline

Definition at line 117 of file AllocatedArray.hxx.

template<class T>
const_reference_type AllocatedArray< T >::front ( ) const
inline

Definition at line 121 of file AllocatedArray.hxx.

template<class T>
void AllocatedArray< T >::GrowDiscard ( size_type  _size)
inline

Grows the array to the specified size, discarding old data.

Similar to ResizeDiscard(), but will never shrink the array to avoid expensive heap operations.

Definition at line 186 of file AllocatedArray.hxx.

template<class T>
void AllocatedArray< T >::GrowPreserve ( size_type  _size,
size_type  preserve 
)
inline

Grows the array to the specified size, preserving the value of a range of elements, starting from the beginning.

Definition at line 195 of file AllocatedArray.hxx.

template<class T>
constexpr bool AllocatedArray< T >::IsNull ( ) const
inline

Definition at line 99 of file AllocatedArray.hxx.

template<class T>
AllocatedArray& AllocatedArray< T >::operator= ( const AllocatedArray< T > &  other)
inline

Definition at line 82 of file AllocatedArray.hxx.

template<class T>
AllocatedArray& AllocatedArray< T >::operator= ( AllocatedArray< T > &&  other)
inline

Definition at line 94 of file AllocatedArray.hxx.

template<class T>
reference_type AllocatedArray< T >::operator[] ( size_type  i)
inline

Returns one element.

No bounds checking.

Definition at line 136 of file AllocatedArray.hxx.

template<class T>
const_reference_type AllocatedArray< T >::operator[] ( size_type  i) const
inline

Returns one constant element.

No bounds checking.

Definition at line 145 of file AllocatedArray.hxx.

template<class T>
void AllocatedArray< T >::ResizeDiscard ( size_type  _size)
inline

Resizes the array, discarding old data.

Definition at line 170 of file AllocatedArray.hxx.

template<class T>
void AllocatedArray< T >::SetSize ( size_type  _size)
inline

Declare that the buffer has the specified size.

Must not be larger than the current size. Excess elements are not used (but they are still allocated).

Definition at line 214 of file AllocatedArray.hxx.

template<class T>
constexpr size_type AllocatedArray< T >::size ( ) const
inline

Returns the number of allocated elements.

Definition at line 113 of file AllocatedArray.hxx.

Field Documentation

template<class T>
Buffer buffer AllocatedArray< T >::nullptr
protected

Definition at line 55 of file AllocatedArray.hxx.


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