Unigine::Vector Class
Header: | #include <UnigineVector.h> |
A vector container template.
In UnigineScript, a vector is a sequence container which represents an array of flexible size. See Containers article for the details.
Vector Class
Members
void set ( int index, const Type & t ) #
Sets an item with a given index.Arguments
- int index - Item index.
- const Type & t - Item to set.
Type & get ( int index ) #
Returns an item by a given index.Arguments
- int index - Item index.
Return value
Item.const Type & get ( int index ) # const
Returns a constant item by a given index.Arguments
- int index - Item index.
Return value
Item.Type * get ( ) #
Returns the pointer to the vector.Return value
Pointer to the vector.const Type * get ( ) # const
Returns the constant pointer to the vector.Return value
Constant pointer to the vector.void allocate ( int size ) #
Reserves the exact amount of memory enough to contain the specified number of items.Arguments
- int size - Exact vector size.
If the specified value is greater than the current vector capacity, the method causes the container to reallocate its storage increasing capacity to the specified value. In all other cases the capacity is not affected.
void append ( const Type & t ) #
Appends an item.Arguments
- const Type & t - Item to append.
void append ( int pos, const Type & t ) #
Appends an item at a given position.Arguments
- int pos - Position.
- const Type & t - Item to append.
void append ( const Vector< Type > & v ) #
Appends a vector.Arguments
- const Vector< Type > & v - Vector to append.
void append ( const Type * v, int size ) #
Appends a vector with a given size.Arguments
- const Type * v - Pointer to the vector to append.
- int size - Vector size.
Iterator back ( ) #
Returns the back iterator.Return value
Back iterator.ConstIterator back ( ) # const
Returns the back iterator.Return value
Back iterator.Iterator begin ( ) #
Returns the begin iterator.Return value
Begin iterator.ConstIterator begin ( ) # const
Returns the begin iterator.Return value
Begin iterator.void clear ( ) #
Clears the vector.void destroy ( ) #
Destroys the vector.int empty ( ) # const
Returns a value indicating if the vector is empty.Return value
1 if the vector is empty; otherwise, 0.Iterator end ( ) #
Returns the end iterator.Return value
End iterator.ConstIterator end ( ) # const
Returns the end iterator.Return value
End iterator.Iterator find ( const T & t ) #
Finds an item in the vector.Arguments
- const T & t - Item.
Return value
Iterator.ConstIterator find ( const T & t ) # const
Finds an item in the vector.Arguments
- const T & t - Item.
Return value
Const iterator.int findIndex ( const T & t ) # const
Finds an index of a given item in the vector.Arguments
- const T & t - Item.
Return value
Item index.int leftIndex ( const T & t ) # const
Returns the index of the left neighbor of a given item.Arguments
- const T & t - Item.
Return value
Left neighbor index.Vector< Type > & operator= ( const Vector< Type > & v ) #
Assignment operator for the vector.Arguments
- const Vector< Type > & v - Vector.
Type & operator[] ( int index ) #
Vector item access.Arguments
- int index - Item index.
Return value
Vector item.const Type & operator[] ( int index ) # const
Vector item access.Arguments
- int index - Item index.
Return value
Vector item.void remove ( ) #
Removes the last item.void remove ( int pos, int size ) #
Removes an item(s) at a given position.Arguments
- int pos - Position.
- int size - Number of items to remove.
void remove ( const Iterator & it ) #
Removes an item indicated by a given iterator.Arguments
- const Iterator & it - Iterator.
void removeFast ( int pos ) #
Removes an item at a given position.Arguments
- int pos - Position.
void removeFast ( const Iterator & it ) #
Removes an item indicated by a given iterator.Arguments
- const Iterator & it - Iterator.
void reserve ( int size ) #
Reserves memory at least enough to contain the specified number of items.Arguments
- int size - Minimum vector size.
If the specified value is greater than the current vector capacity, the method causes the container to reallocate its storage increasing capacity to the specified value (or greater). In all other cases the capacity is not affected.
void resize ( int size ) #
Resizes a vector.Arguments
- int size - New vector size.
int rightIndex ( const T & t ) # const
Returns the index of the right neighbor of a given item.Arguments
- const T & t - Item.
Return value
Right neighbor index.int size ( ) # const
Returns the size of the vector.Return value
Vector size.int space ( ) # const
Returns the capacity of the vector. The value may be greater than the size.Return value
Vector capacity.Vector ( ) #
Default constructor. Produces an empty vector.Vector ( const Vector< Type > & v ) #
Copy constructor.Arguments
- const Vector< Type > & v - Vector.
Vector ( const Type & t, int size ) #
Constructor. Produces a vector with a specified size and initialization.Arguments
- const Type & t - Item value.
- int size - Vector size.
Vector ( const Type * v, int size ) #
Copy constructor. Produces a vector with a specified size.Arguments
- const Type * v - Vector pointer.
- int size - Vector size.
explicit Vector ( int size ) #
Explicit constructor. Produces a vector with specified size.Arguments
- int size - Vector size.
~Vector ( ) #
Destructor.Last update:
2019-08-16
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)