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 ( size_t index, const Type & t ) #
Sets an item with a given index.Arguments
- size_t index - Item index.
- const Type & t - Item to set.
Type & get ( size_t index ) #
Returns an item by a given index.Arguments
- size_t index - Item index.
Return value
Item.const Type & get ( size_t index ) const#
Returns a constant item by a given index.Arguments
- size_t 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 ( size_t size ) #
Reserves the exact amount of memory enough to contain the specified number of items.Arguments
- size_t 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 ( size_t pos, const Type & t ) #
Appends an item at a given position.Arguments
- size_t 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, size_t size ) #
Appends a vector with a given size.Arguments
- const Type * v - Pointer to the vector to append.
- size_t 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.bool empty ( ) const#
Returns a value indicating if the vector is empty.Return value
true if the vector is empty; otherwise, false.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[] ( size_t index ) #
Vector item access.Arguments
- size_t index - Item index.
Return value
Vector item.const Type & operator[] ( size_t index ) const#
Vector item access.Arguments
- size_t index - Item index.
Return value
Vector item.void remove ( ) #
Removes the last item.void remove ( size_t pos, size_t size ) #
Removes an item(s) at a given position.Arguments
- size_t pos - Position.
- size_t 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 ( size_t pos ) #
Removes an item at a given position.Arguments
- size_t pos - Position.
void removeFast ( const Iterator & it ) #
Removes an item indicated by a given iterator.Arguments
- const Iterator & it - Iterator.
void reserve ( size_t size ) #
Reserves memory at least enough to contain the specified number of items.Arguments
- size_t 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 ( size_t size ) #
Resizes a vector.Arguments
- size_t 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, size_t size ) #
Constructor. Produces a vector with a specified size and initialization.Arguments
- const Type & t - Item value.
- size_t size - Vector size.
Vector ( const Type * v, size_t size ) #
Copy constructor. Produces a vector with a specified size.Arguments
- const Type * v - Vector pointer.
- size_t size - Vector size.
explicit Vector ( size_t size ) #
Explicit constructor. Produces a vector with specified size.Arguments
- size_t size - Vector size.
~Vector ( ) #
Destructor.Last update:
2021-12-13
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)