SmallArray< T, B, N > Class Template Reference

Flexible array with size limit. More...

#include <array.hpp>

Public Member Functions

FORCEINLINE SmallArray ()
 implicit constructor
FORCEINLINE void Clear ()
 Clear (destroy) all items.
FORCEINLINE uint Length () const
 Return actual number of items.
FORCEINLINE bool IsEmpty ()
 return true if array is empty
FORCEINLINE bool IsFull ()
 return true if array is full
FORCEINLINE T * Append ()
 allocate but not construct new item
FORCEINLINE T * AppendC ()
 allocate and construct new item
FORCEINLINE T & operator[] (uint index)
 indexed access (non-const)
FORCEINLINE const T & operator[] (uint index) const
 indexed access (const)
template<typename D >
void Dump (D &dmp) const

Protected Types

typedef FixedSizeArray< T, B > SubArray
 inner array
typedef FixedSizeArray
< SubArray, N > 
SuperArray
 outer array

Protected Member Functions

FORCEINLINE SubArrayFirstFreeSubArray ()
 return first sub-array with free space for new item

Protected Attributes

SuperArray data
 array of arrays of items

Static Protected Attributes

static const uint Tcapacity = B * N
 total max number of items

Detailed Description

template<class T, uint B = 1024, uint N = B>
class SmallArray< T, B, N >

Flexible array with size limit.

Implemented as fixed size array of fixed size arrays

Definition at line 21 of file array.hpp.


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

Generated on Wed Mar 3 23:33:31 2010 for OpenTTD by  doxygen 1.6.1