#include <LightVector.hpp>
Collaboration diagram for LightVector< TYPE >:
Public Member Functions | |
LightVector (TYPE *const values, int &size) | |
Create a new LightVector wrapper around an ordinary array and a size variable. | |
LightVector (TYPE *const values, int &size, int capacity) | |
int | size () const |
Return the actual size and increment size afterwards by 1. | |
bool | empty () const |
void | resize (int size) |
Set the size of the container to the given value. | |
void | clear () |
TYPE | operator[] (int index) const |
Get an entry of the container at a given index. | |
TYPE | back () const |
void | setEntry (int index, TYPE value) |
Set the value of an entry to a given value. | |
void | push_back (TYPE value) |
void | pop_back () |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
TYPE * | values () const |
Access the storage model of this vector directly. | |
int | capacity () const |
void | destroy () |
Destroy a LightVector and its storage. | |
Static Public Member Functions | |
static LightVector< TYPE > * | create (int capacity, TYPE initValue=TYPE()) |
Create and initialize a new LightVector with managed storage. | |
Private Attributes | |
TYPE *const | m_values |
int & | m_size |
int const | m_capacity |
Classes | |
class | const_iterator |
class | iterator |
You can use it mostly like a vector with fixed and not stored capacity (but not all methods are implemented yet).
Differences to STL vector are:
setEntry
and resize
, if you want to set an entry or change the size. values()
to access the array of values directly. capacity
is only available in debugging mode. LightVector does not manage the memory, i.e., it does not release the array after destruction.
LightVector performs bounds checking if compiled with DEBUG_LEVEL > 0 and no bounds checking if compiled with DEBUG_LEVEL == 0.
LightVector is designed for elementary data types as its accessor methods return values (TYPE) and not const references to values (const TYPE&), because returning just values has shown much faster in some experiments.
Definition at line 50 of file LightVector.hpp.
|
Create a new LightVector wrapper around an ordinary array and a size variable.
Definition at line 56 of file LightVector.hpp. Referenced by LightVector< TYPE >::create(). |
|
Definition at line 57 of file LightVector.hpp. |
|
Definition at line 94 of file LightVector.hpp. References LightVector< TYPE >::m_size, and LightVector< TYPE >::m_values. |
|
Definition at line 327 of file LightVector.hpp. References LightVector< TYPE >::m_size, and LightVector< TYPE >::m_values. |
|
Definition at line 323 of file LightVector.hpp. References LightVector< TYPE >::m_capacity, and LightVector< TYPE >::m_values. Referenced by cardinality_of_set_intersection(), main(), and set_intersection(). |
|
Definition at line 352 of file LightVector.hpp. References LightVector< TYPE >::m_capacity. Referenced by main(), and set_intersection(). |
|
Definition at line 81 of file LightVector.hpp. References LightVector< TYPE >::m_size. |
|
Create and initialize a new LightVector with managed storage.
Please note that this will NOT be released by Definition at line 360 of file LightVector.hpp. References LightVector< TYPE >::LightVector(), and LightVector< TYPE >::values(). Referenced by main(). |
|
Destroy a LightVector and its storage.
This should only be called for LightVectors created by Definition at line 375 of file LightVector.hpp. References LightVector< TYPE >::m_size, and LightVector< TYPE >::m_values. |
|
Definition at line 69 of file LightVector.hpp. References LightVector< TYPE >::size(). |
|
Definition at line 328 of file LightVector.hpp. References LightVector< TYPE >::m_size, and LightVector< TYPE >::m_values. |
|
Definition at line 324 of file LightVector.hpp. References LightVector< TYPE >::m_capacity, LightVector< TYPE >::m_size, and LightVector< TYPE >::m_values. Referenced by cardinality_of_set_intersection(), main(), and set_intersection(). |
|
Get an entry of the container at a given index.
Contrary to vector, it does only return a read-only value; use Definition at line 88 of file LightVector.hpp. References LightVector< TYPE >::m_size, and LightVector< TYPE >::m_values. |
|
Definition at line 113 of file LightVector.hpp. References LightVector< TYPE >::m_size. |
|
Definition at line 108 of file LightVector.hpp. References LightVector< TYPE >::m_capacity, LightVector< TYPE >::m_size, and LightVector< TYPE >::m_values. |
|
Set the size of the container to the given value. Contrary to vector, it does not initialize newly-creared entries. Definition at line 76 of file LightVector.hpp. References LightVector< TYPE >::m_capacity, and LightVector< TYPE >::m_size. Referenced by main(). |
|
Set the value of an entry to a given value.
Definition at line 102 of file LightVector.hpp. References LightVector< TYPE >::m_capacity, and LightVector< TYPE >::m_values. |
|
Return the actual size and increment size afterwards by 1.
Contrary to vector, it does only return a read-only value; use Definition at line 67 of file LightVector.hpp. References LightVector< TYPE >::m_size. Referenced by cardinality_of_set_intersection(), LightVector< TYPE >::empty(), and set_intersection(). |
|
Access the storage model of this vector directly.
Definition at line 349 of file LightVector.hpp. References LightVector< TYPE >::m_values. Referenced by LightVector< TYPE >::create(). |
|
Definition at line 386 of file LightVector.hpp. Referenced by LightVector< TYPE >::begin(), LightVector< TYPE >::capacity(), LightVector< TYPE >::end(), LightVector< TYPE >::push_back(), LightVector< TYPE >::resize(), and LightVector< TYPE >::setEntry(). |
|
|