Tizen Native API
6.5
|
Vector class with minimum space allocation when it's empty. More...
Inherits VectorAlgorithms< IsTrivialType >.
Public Types | |
enum | |
Enumeration for BaseType. More... | |
typedef VectorBase::SizeType | SizeType |
Type definitions. | |
typedef T * | Iterator |
Most simple Iterator is a pointer. | |
typedef const T * | ConstIterator |
Const iterator. | |
typedef T | ItemType |
Item type. | |
Public Member Functions | |
Vector () | |
Default constructor. Does not allocate any space. | |
~Vector () | |
Destructor. Releases the allocated space. | |
Vector (const Vector &vector) | |
Copy constructor. | |
Vector & | operator= (const Vector &vector) |
Assignment operator. | |
Iterator | Begin () const |
Iterator to the beginning of the data. | |
Iterator | End () const |
Iterator to the end of the data (one past last element). | |
Iterator | begin () const |
Iterator | end () const |
ItemType & | operator[] (SizeType index) |
Subscript operator. | |
const ItemType & | operator[] (SizeType index) const |
Subscript operator. | |
void | PushBack (const ItemType &element) |
Pushes back an element to the vector. | |
void | Insert (Iterator at, const ItemType &element) |
Inserts an element to the vector. | |
void | Insert (Iterator at, Iterator from, Iterator to) |
Inserts the given elements into the vector. | |
void | Reserve (SizeType count) |
Reserves space in the vector. | |
void | Resize (SizeType count) |
Resizes the vector. Does not change capacity. | |
void | Resize (SizeType count, const ItemType &item) |
Resizes the vector. Does not change capacity. | |
Iterator | Erase (Iterator iterator) |
Erases an element. | |
Iterator | Erase (Iterator first, Iterator last) |
Erases a range of elements. | |
void | Remove (Iterator iterator) |
Removes an element. | |
void | Swap (Vector &vector) |
Swaps the contents of two vectors. | |
void | Clear () |
Clears the contents of the vector. Keeps its capacity. | |
void | Release () |
Releases the memory that the vector holds. |
Detailed Description
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
class Dali::Vector< T, IsTrivialType >
Vector class with minimum space allocation when it's empty.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
type The type of the data that the vector holds
Member Typedef Documentation
typedef const T* Dali::Vector< T, IsTrivialType >::ConstIterator |
Const iterator.
- Since:
- 3.0, DALi version 1.0.0
typedef T Dali::Vector< T, IsTrivialType >::ItemType |
Item type.
- Since:
- 3.0, DALi version 1.0.0
typedef T* Dali::Vector< T, IsTrivialType >::Iterator |
Most simple Iterator is a pointer.
- Since:
- 3.0, DALi version 1.0.0
typedef VectorBase::SizeType Dali::Vector< T, IsTrivialType >::SizeType |
Type definitions.
- Since:
- 3.0, DALi version 1.0.0 Size type
- Since:
- 3.0, DALi version 1.0.0
Member Enumeration Documentation
anonymous enum |
Constructor & Destructor Documentation
Dali::Vector< T, IsTrivialType >::Vector | ( | ) |
Default constructor. Does not allocate any space.
- Since:
- 3.0, DALi version 1.0.0
Dali::Vector< T, IsTrivialType >::~Vector | ( | ) |
Destructor. Releases the allocated space.
- Since:
- 3.0, DALi version 1.0.0
Dali::Vector< T, IsTrivialType >::Vector | ( | const Vector< T, IsTrivialType > & | vector | ) |
Member Function Documentation
Iterator Dali::Vector< T, IsTrivialType >::Begin | ( | ) | const |
Iterator to the beginning of the data.
- Since:
- 3.0, DALi version 1.0.0
- Returns:
- Iterator to the beginning of the data
Iterator Dali::Vector< T, IsTrivialType >::begin | ( | ) | const |
Support for C++11 Range-based for loop: for( item : container ).
- Since:
- 4.0, DALi version 1.2.60
- Returns:
- The start iterator
void Dali::Vector< T, IsTrivialType >::Clear | ( | ) |
Clears the contents of the vector. Keeps its capacity.
- Since:
- 3.0, DALi version 1.0.0
Iterator Dali::Vector< T, IsTrivialType >::End | ( | ) | const |
Iterator to the end of the data (one past last element).
- Since:
- 3.0, DALi version 1.0.0
- Returns:
- Iterator to the end of the data (one past last element)
Iterator Dali::Vector< T, IsTrivialType >::end | ( | ) | const |
Support for C++11 Range-based for loop: for( item : container ).
- Since:
- 4.0, DALi version 1.2.60
- Returns:
- The end iterator
Iterator Dali::Vector< T, IsTrivialType >::Erase | ( | Iterator | iterator | ) |
Erases an element.
Does not change capacity. Other elements get moved.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] iterator Iterator pointing to the item to remove
- Returns:
- Iterator pointing to next element
- Precondition:
- Iterator iterator must be within the vector's range ( Vector::Begin(), Vector::End() - 1 ).
Iterator Dali::Vector< T, IsTrivialType >::Erase | ( | Iterator | first, |
Iterator | last | ||
) |
Erases a range of elements.
Does not change capacity. Other elements get moved.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] first Iterator to the first element to be erased [in] last Iterator to the last element to be erased
- Returns:
- Iterator pointing to the next element of the last one
- Precondition:
- Iterator first must be in the vector's range ( Vector::Begin(), Vector::End() ).
- Iterator last must be in the vector's range ( Vector::Begin(), Vector::End() ).
- Iterator first must not be grater than Iterator last.
void Dali::Vector< T, IsTrivialType >::Insert | ( | Iterator | at, |
const ItemType & | element | ||
) |
Inserts an element to the vector.
Elements after at are moved one position to the right.
The underlying storage may be reallocated to provide space. If this occurs, all pre-existing pointers into the vector will become invalid.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] at Iterator where to insert the elements into the vector [in] element An element to be added
- Precondition:
- Iterator at must be in the vector's range ( Vector::Begin(), Vector::End() ).
void Dali::Vector< T, IsTrivialType >::Insert | ( | Iterator | at, |
Iterator | from, | ||
Iterator | to | ||
) |
Inserts the given elements into the vector.
Elements after at are moved the number of given elements positions to the right.
The underlying storage may be reallocated to provide space. If this occurs, all pre-existing pointers into the vector will become invalid.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] at Iterator where to insert the elements into the vector [in] from Iterator to the first element to be inserted [in] to Iterator to the last element to be inserted
- Precondition:
- Iterator at must be in the vector's range ( Vector::Begin(), Vector::End() ).
- Iterators from and to must be valid iterators.
- Iterator from must not be grater than Iterator to.
Vector& Dali::Vector< T, IsTrivialType >::operator= | ( | const Vector< T, IsTrivialType > & | vector | ) |
Assignment operator.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] vector Vector to assign from
- Returns:
- Reference to self for chaining
ItemType& Dali::Vector< T, IsTrivialType >::operator[] | ( | SizeType | index | ) |
Subscript operator.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] index Index of the element
- Returns:
- Reference to the element for given index
- Precondition:
- Index must be in the vector's range.
const ItemType& Dali::Vector< T, IsTrivialType >::operator[] | ( | SizeType | index | ) | const |
Subscript operator.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] index Index of the element
- Returns:
- Reference to the element for given index
- Precondition:
- Index must be in the vector's range.
void Dali::Vector< T, IsTrivialType >::PushBack | ( | const ItemType & | element | ) |
Pushes back an element to the vector.
The underlying storage may be reallocated to provide space. If this occurs, all pre-existing pointers into the vector will become invalid.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] element Element to be added
void Dali::Vector< T, IsTrivialType >::Release | ( | ) |
Releases the memory that the vector holds.
- Since:
- 3.0, DALi version 1.0.0
void Dali::Vector< T, IsTrivialType >::Remove | ( | Iterator | iterator | ) |
Removes an element.
Does not maintain order. Swaps the element with end and decreases size by one. This is much faster than Erase so use this in case order does not matter. Does not change capacity.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] iterator Iterator pointing to the item to remove
- Precondition:
- Iterator iterator must be in the vector's range ( Vector::Begin(), Vector::End() - 1 ).
void Dali::Vector< T, IsTrivialType >::Reserve | ( | SizeType | count | ) |
Reserves space in the vector.
Reserving less than current Capacity is a no-op.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] count Count of elements to reserve
void Dali::Vector< T, IsTrivialType >::Resize | ( | SizeType | count | ) |
Resizes the vector. Does not change capacity.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] count Count to resize to
void Dali::Vector< T, IsTrivialType >::Resize | ( | SizeType | count, |
const ItemType & | item | ||
) |
Resizes the vector. Does not change capacity.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] count Count to resize to [in] item An item to insert to the new indices
void Dali::Vector< T, IsTrivialType >::Swap | ( | Vector< T, IsTrivialType > & | vector | ) |
Swaps the contents of two vectors.
- Since:
- 3.0, DALi version 1.0.0
- Parameters:
-
[in] vector Vector to swap with