Frobby  0.9.5
Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
LocalArray< T, ArenaSource > Class Template Reference

Emulates stack allocation of an array using an Arena. More...

#include <LocalArray.h>

Public Member Functions

 LocalArray (const size_t sizeParam)
 
 ~LocalArray ()
 
T & operator[] (const size_t i) const
 
T * begin () const
 
T * end () const
 
size_t size () const
 

Static Private Member Functions

static const pair< T *, T * > gccWorkAround (const size_t size)
 

Private Attributes

const size_t _size
 
const pair< T *, T * > _range
 

Detailed Description

template<class T, class ArenaSource = Arena>
class LocalArray< T, ArenaSource >

Emulates stack allocation of an array using an Arena.

The scoping rules of C++ ensure stack order allocation and deallocation if the Arena is only accessed using objects like this.

T is the type of the objects to make an array of.

ArenaSource is any type that has a public and static getArena function. That function must return a reference to the same Arena each time it is called. ArenaSource is useful for testing.

Definition at line 36 of file LocalArray.h.

Constructor & Destructor Documentation

◆ LocalArray()

template<class T , class ArenaSource = Arena>
LocalArray< T, ArenaSource >::LocalArray ( const size_t  sizeParam)
inline

Definition at line 38 of file LocalArray.h.

◆ ~LocalArray()

template<class T , class ArenaSource = Arena>
LocalArray< T, ArenaSource >::~LocalArray ( )
inline

Definition at line 44 of file LocalArray.h.

Member Function Documentation

◆ begin()

template<class T , class ArenaSource = Arena>
T* LocalArray< T, ArenaSource >::begin ( ) const
inline

Definition at line 54 of file LocalArray.h.

◆ end()

template<class T , class ArenaSource = Arena>
T* LocalArray< T, ArenaSource >::end ( ) const
inline

Definition at line 55 of file LocalArray.h.

◆ gccWorkAround()

template<class T , class ArenaSource = Arena>
static const pair<T*, T*> LocalArray< T, ArenaSource >::gccWorkAround ( const size_t  size)
inlinestaticprivate

Definition at line 59 of file LocalArray.h.

◆ operator[]()

template<class T , class ArenaSource = Arena>
T& LocalArray< T, ArenaSource >::operator[] ( const size_t  i) const
inline

Definition at line 49 of file LocalArray.h.

◆ size()

template<class T , class ArenaSource = Arena>
size_t LocalArray< T, ArenaSource >::size ( ) const
inline

Definition at line 56 of file LocalArray.h.

Member Data Documentation

◆ _range

template<class T , class ArenaSource = Arena>
const pair<T*, T*> LocalArray< T, ArenaSource >::_range
private

Definition at line 73 of file LocalArray.h.

◆ _size

template<class T , class ArenaSource = Arena>
const size_t LocalArray< T, ArenaSource >::_size
private

Definition at line 72 of file LocalArray.h.


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