#include <Containers.h>
minimalist vector with a tight memory array the particularity is not to pre-allocate (no unused memory is allocated without a user choice) not efficient to add an entry (since it must resize the array)
Protected Attributes | |
T * | _array |
the array where to store the entries More... | |
size_t | _size |
the array size More... | |
Public Member Functions | |
NoPreallocationVector () | |
default constructor, no allocation, no initialization More... | |
NoPreallocationVector (size_t size) | |
given allocation, no initialization More... | |
~NoPreallocationVector () | |
default destructor More... | |
NoPreallocationVector (const NoPreallocationVector< T > &c) | |
copy constructor More... | |
void | clear () |
free memory More... | |
void | operator= (const NoPreallocationVector< T > &c) |
clone More... | |
bool | operator== (const NoPreallocationVector< T > &c) const |
comparison More... | |
bool | operator!= (const NoPreallocationVector< T > &c) const |
difference More... | |
void | push_back (const T &v) |
void | resize (size_t newSize) |
void | resizeAndKeep (size_t newSize) |
already-existing data is preserved More... | |
int | find (const T &v) const |
bool | isPresent (const T &v) const |
int | getOffset (const T *v) const |
T & | operator[] (size_t index) |
entry accessor More... | |
const T & | operator[] (size_t index) const |
entry const accessor More... | |
T & | first () |
first entry accessor More... | |
const T & | first () const |
first entry const accessor More... | |
T & | last () |
last entry accessor More... | |
const T & | last () const |
last entry const accessor More... | |
size_t | size () const |
bool | empty () const |
void | fill (const T &v) |
fill all array entries with the given value v More... | |
Friends | |
std::istream & | operator>> (std::istream &in, NoPreallocationVector< T > &) |
read More... | |
std::ostream & | operator<< (std::ostream &out, const NoPreallocationVector< T > &) |
write More... | |
|
protected |
the array where to store the entries
|
protected |
the array size
|
inline |
default constructor, no allocation, no initialization
|
inline |
given allocation, no initialization
|
inline |
default destructor
|
inline |
copy constructor
|
inline |
free memory
|
inline |
|
inline |
fill all array entries with the given value v
|
inline |
|
inline |
first entry accessor
|
inline |
first entry const accessor
|
inline |
|
inline |
|
inline |
last entry accessor
|
inline |
last entry const accessor
|
inline |
difference
|
inline |
clone
|
inline |
comparison
|
inline |
entry accessor
|
inline |
entry const accessor
|
inline |
add a entry at the end
|
inline |
|
inline |
already-existing data is preserved
|
inline |
|
friend |
write
|
friend |
read