Vector< Type > Class Template (C++)
Vector container template.
To use this class, include the UnigineVector.h file.
Unigine::Vector Class
Members
Vector ()
Default constructor that produces an empty vector.Vector (const Vector< Type > & v)
Copy constructor.Arguments
- const Vector< Type > & v - Vector.
Vector (const Type & t, int size)
Constructor that produces a vector with specified size and initialization.Arguments
- const Type & t - Item value.
- int size - Vector size.
Vector (const Type * v, int size)
Copy constructor that produces a vector with specified size.Arguments
- const Type * v - Vector pointer.
- int size - Vector size.
explicit Vector (int size)
Explicit constructor that produces a vector with specified size.Arguments
- int size - Vector size.
~Vector ()
Destructor.Vector< Type > & operator= (const Vector< Type > & v)
Assignment operator for the vector.Arguments
- const Vector< Type > & v - Vector.
UNIGINE_INLINE Type & operator[] (int index)
Vector access.Arguments
- int index - Array item index.
Return value
The vector item.UNIGINE_INLINE const Type & operator[] (int index) const
Constant vector access.Arguments
- int index - Array item index.
Return value
The vector item.UNIGINE_INLINE void set (int index, const Type & t)
Set an item by index.Arguments
- int index - Item index.
- const Type & t - Item to set.
UNIGINE_INLINE Type & get (int index)
Return an item by index.Arguments
- int index - Item index.
Return value
The item.UNIGINE_INLINE const Type & get (int index) const
Return an constant item by index.Arguments
- int index - Item index.
Return value
The item.UNIGINE_INLINE Type * get ()
Return the pointer to the vector.Return value
The vector.UNIGINE_INLINE const Type * get () const
Return the constant pointer to the vector.Return value
The vector.UNIGINE_INLINE Iterator begin ()
Returns the begin iterator.Return value
Begin iterator.UNIGINE_INLINE Iterator back ()
Returns the back iterator.Return value
Back iterator.UNIGINE_INLINE Iterator end ()
Returns the end iterator.Return value
End iterator.UNIGINE_INLINE ConstIterator begin () const
Returns the begin iterator.Return value
Begin iterator.UNIGINE_INLINE ConstIterator back () const
Returns the back iterator.Return value
Back iterator.UNIGINE_INLINE ConstIterator end () const
Returns the end iterator.Return value
End iterator.UNIGINE_INLINE int size () const
Returns the size of the vector.Return value
The size of the vector.UNIGINE_INLINE int empty () const
Returns the 1 if the vector is empty; otherwise, 0 is returned.Return value
The empty flag.UNIGINE_INLINE int space () const
Returns the internal size of the vector.Return value
The internal size of the vector.void resize (int size)
Resizes a vector.Arguments
- int size - Size of vector.
void allocate (int size)
Allocates a vector.Arguments
- int size - Size of allocated items.
void reserve (int size)
Reserves a vector.Arguments
- int size - Size of reserves items.
UNIGINE_INLINE void clear ()
Clears the vector.void destroy ()
Destroys the vector.Iterator find (const T & t)
Finds an item in the vector.Arguments
- const T & t - Item.
Return value
The iterator.ConstIterator find (const T & t) const
Finds an item in the vector.Arguments
- const T & t - Item.
Return value
The const iterator.int findIndex (const T & t) const
Finds an item in the vector.Arguments
- const T & t - Item.
Return value
The item number.int leftIndex (const T & t) const
Finds an item with lower value.Arguments
- const T & t - Item.
Return value
The item number.int rightIndex (const T & t) const
Finds an item with greater value.Arguments
- const T & t - Item.
Return value
The item number.UNIGINE_INLINE void append (const Type & t)
Appends an item.Arguments
- const Type & t - Item.
void append (int pos, const Type & t)
Appends an item at position.Arguments
- int pos - Position.
- const Type & t - Item.
void append (const Vector< Type > & v)
Appends a vector.Arguments
- const Vector< Type > & v - Vector.
void append (const Type * v, int size)
Appends a vector.Arguments
- const Type * v - Vector pointer.
- int size - Vector size.
UNIGINE_INLINE void remove ()
Removes the last item.void remove (int pos, int size)
Removes an item at position.Arguments
- int pos - Position.
- int size - The number of items to remove.
UNIGINE_INLINE void remove (const Iterator & it)
Removes an item at position.Arguments
- const Iterator & it - The iterator.
UNIGINE_INLINE void removeFast (int pos)
Removes an item at position.Arguments
- int pos - Position.
UNIGINE_INLINE void removeFast (const Iterator & it)
Removes an item at position.Arguments
- const Iterator & it - The iterator.
Last update: 2017-07-03
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)