Array of structured objects. More...
#include <avir.h>
Public Member Functions | |
CStructArray (const CStructArray &Source) | |
Copies the specified array element-by-element. | |
T & | add () |
Creates a new object of type T with the default constructor, and adds this object to the array. | |
void | clear () |
Erases all items of this array. | |
int | getItemCount () const |
Returns the number of allocated items. | |
CStructArray & | operator= (const CStructArray &Source) |
Copies the specified array element-by-element. | |
T & | operator[] (const int Index) |
Returns writable reference to the specified element. | |
const T & | operator[] (const int Index) const |
Returns const reference to the specified element. | |
void | setItemCount (const int NewCount) |
Changes the number of allocated items. | |
Array of structured objects.
Implements allocation of a linear array of objects of class T
(which are initialized), addressable via operator[]
. Each object is created via the operator new
. New object insertions are quick since implementation uses prior space allocation (capacity), thus not requiring frequent memory block reallocations.
T | Array element's type. |
avir::CStructArray< T >::CStructArray | ( | const CStructArray< T > & | Source | ) |
Copies the specified array element-by-element.
Source | Source array. |
T & avir::CStructArray< T >::add | ( | ) |
Creates a new object of type T with the default constructor, and adds this object to the array.
CStructArray & avir::CStructArray< T >::operator= | ( | const CStructArray< T > & | Source | ) |
Copies the specified array element-by-element.
Source | Source array. |
T & avir::CStructArray< T >::operator[] | ( | const int | Index | ) |
Returns writable reference to the specified element.
Index | Element's index. |
const T & avir::CStructArray< T >::operator[] | ( | const int | Index | ) | const |
Returns const
reference to the specified element.
Index | Element's index. |
void avir::CStructArray< T >::setItemCount | ( | const int | NewCount | ) |
Changes the number of allocated items.
New items are created with the default constructor. If NewCount
is below the current item count, items that are above NewCount
range will be destructed.
NewCount | New requested item count. |