#include <array_t.h>
Inheritance diagram for base::array_t< T >:

Public Types | |
| enum | { INC = 8 } |
| increase size step: at least 1 More... | |
Public Member Functions | |
| array_t (size_t initSize=4) | |
| constructor: alloc and init the array to 0 always at least 1 element. | |
| ~array_t () | |
| destructor: free the array | |
| array_t (const array_t< T > &arr) | |
| Copy constructor. | |
| array_t & | operator= (array_t< T > &arr) |
| copy operator | |
| T | get (size_t at) const |
| data read: test if outside bounds | |
| void | set (size_t at, T value) |
| data write: may increase array | |
| T | replace (size_t at, T value) |
| data read/write: may increase array | |
| void | add (size_t at, T value) |
| addition with the given argument | |
Private Member Functions | |
| void | ensurePos (size_t at) |
| make sure position at may be accessed | |
The idea is to be able to access the array randomly even on non predefined position. The array will grow automatically. This is not possible with std::vector: you have to define a loop and use push_back() to fill the gaps. Besides, reading outside the vector will seg-fault.
Lower case name: basic template on basic scalar types only this class is not supposed to have sub-classes
|
|||||
|
increase size step: at least 1
|
|
||||||||||
|
constructor: alloc and init the array to 0 always at least 1 element.
|
|
|||||||||
|
destructor: free the array
|
|
||||||||||
|
Copy constructor.
|
|
||||||||||||||||
|
addition with the given argument
|
|
||||||||||
|
make sure position at may be accessed
|
|
||||||||||
|
data read: test if outside bounds
|
|
||||||||||
|
copy operator
|
|
||||||||||||||||
|
data read/write: may increase array
|
|
||||||||||||||||
|
data write: may increase array
|
1.4.2