18#ifndef __LIBSTD_VECTOR_H
19#define __LIBSTD_VECTOR_H
36#define VECTOR_DEFAULT_SIZE 64
153 virtual const T &
at(
Size position)
const
228 T *arr =
new T[
size];
Sequences are containers that provide indexed based storage of items.
Vectors are dynamically resizeable Arrays.
virtual void clear()
Remove all items from the vector.
Size m_size
The maximum size of the array.
virtual const T * vector() const
Get Vector data pointer.
virtual const T & at(Size position) const
Return item at the given position as a reference.
Vector(const Vector< T > &a)
Copy constructor.
Size m_count
Number of used items in the array.
virtual const T * get(Size position) const
Returns the item at the given position.
virtual Size size() const
Returns the maximum size of this Vector.
T * m_array
The actual array where the data is stored.
virtual ~Vector()
Destructor.
virtual bool resize(Size size)
Resize the Vector.
virtual int insert(const T &item)
Adds the given item to the Vector, if possible.
virtual bool removeAt(Size position)
Removes the item at the given position.
virtual bool insert(Size position, const T &item)
Inserts the given item at the given position.
virtual Size count() const
Returns the number of items inside the Vector.
Vector(Size size=VECTOR_DEFAULT_SIZE)
Constructor.
#define assert(exp)
Insert program diagnostics.
#define VECTOR_DEFAULT_SIZE
Default size of an Vector.
unsigned int Size
Any sane size indicator cannot go negative.