# CFixedSizeArrayT< Titem_, Tcapacity_ > Struct Template Reference

fixed size array Upon construction it preallocates fixed size block of memory for all items, but doesn't construct them. More...

`#include <fixedsizearray.hpp>`

## Public Types

typedef Titem_ | Titem

## Public Member Functions

| CFixedSizeArrayT ()
| Default constructor.
| CFixedSizeArrayT (const CFixedSizeArrayT< Titem_, Tcapacity_ > &src)
| Copy constructor.
| ~CFixedSizeArrayT ()
| destroy remaining items and free the memory block
FORCEINLINE void | Clear ()
| Clear (destroy) all items.
FORCEINLINE int | Size () const
| return number of used items
FORCEINLINE bool | IsFull () const
| return true if array is full
FORCEINLINE bool | IsEmpty () const
| return true if array is empty
FORCEINLINE void | CheckIdx (int idx) const
| index validation
FORCEINLINE Titem & | AddNC ()
| add (allocate), but don't construct item
FORCEINLINE Titem & | Add ()
| add and construct item using default constructor
FORCEINLINE Titem & | operator[] (int idx)
| return item by index (non-const version)
FORCEINLINE const Titem & | operator[] (int idx) const
| return item by index (const version)

## Data Fields

Titem_ * | m_items
| the only member of fixed size array is pointer to the block of C array of items.

## Static Public Attributes

static const int | Tcapacity = Tcapacity_
static const int | TitemSize = sizeof(Titem_)
static const int | ThdrSize = sizeof(CHdr)

## Protected Member Functions

FORCEINLINE CHdr & | Hdr ()
| return reference to the array header (non-const)
FORCEINLINE const CHdr & | Hdr () const
| return reference to the array header (const)
FORCEINLINE int & | RefCnt ()
| return reference to the block reference counter
FORCEINLINE int & | SizeRef ()
| return reference to number of used items

## Data Structures

struct | CHdr
| header for fixed size array More...

## Detailed Description

### template<class Titem_, int Tcapacity_>
struct CFixedSizeArrayT< Titem_, Tcapacity_ >

fixed size array Upon construction it preallocates fixed size block of memory for all items, but doesn't construct them.

Item's construction is delayed.

Definition at line 14 of file fixedsizearray.hpp.

## Constructor & Destructor Documentation

template<class Titem_, int Tcapacity_>

CFixedSizeArrayT< Titem_, Tcapacity_ >::CFixedSizeArrayT | ( |  | ) | `[inline]`

Default constructor.

Preallocate space for items and header, then initialize header.

Definition at line 34 of file fixedsizearray.hpp.

template<class Titem_, int Tcapacity_>

CFixedSizeArrayT< Titem_, Tcapacity_ >::CFixedSizeArrayT | ( | const CFixedSizeArrayT< Titem_, Tcapacity_ > & | src | ) | `[inline]`

Copy constructor.

Preallocate space for items and header, then initialize header.

Definition at line 43 of file fixedsizearray.hpp.

## Field Documentation

template<class Titem_, int Tcapacity_>

Titem_* CFixedSizeArrayT< Titem_, Tcapacity_ >::m_items

the only member of fixed size array is pointer to the block of C array of items.

Header can be found on the offset -sizeof(CHdr).

Definition at line 17 of file fixedsizearray.hpp.

Referenced by CFixedSizeArrayT< CSubArray, Tnum_blocks_ >::AddNC(), CFixedSizeArrayT< CSubArray, Tnum_blocks_ >::CFixedSizeArrayT(), CFixedSizeArrayT< CSubArray, Tnum_blocks_ >::Clear(), CFixedSizeArrayT< CSubArray, Tnum_blocks_ >::Hdr(), CFixedSizeArrayT< CSubArray, Tnum_blocks_ >::operator[](), and CFixedSizeArrayT< CSubArray, Tnum_blocks_ >::~CFixedSizeArrayT().

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

- src/misc/fixedsizearray.hpp