Tizen Native API
|
Vector class with minimum space allocation when its empty. More...
Public Types | |
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). | |
ItemType & | operator[] (SizeType index) |
Subscript operator. | |
const ItemType & | operator[] (SizeType index) const |
Subscript operator. | |
void | PushBack (const ItemType &element) |
Push back an element to the vector. | |
void | Insert (Iterator at, const ItemType &element) |
Insert an element to the vector. | |
void | Insert (Iterator at, Iterator from, Iterator to) |
Inserts the given elements into the vector. | |
void | Reserve (SizeType count) |
Reserve space in the vector. | |
void | Resize (SizeType count, ItemType item=ItemType()) |
Resize the vector. Does not change capacity. | |
Iterator | Erase (Iterator iterator) |
Erase an element. | |
Iterator | Erase (Iterator first, Iterator last) |
Erase a range of elements. | |
void | Remove (Iterator iterator) |
Removes an element. | |
void | Swap (Vector &vector) |
Swap the contents of two vectors. | |
void | Clear () |
Clear the contents of the vector. Keeps its capacity. | |
void | Release () |
Release 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 its empty.
- Since :
- 2.4
- Parameters:
-
[in] type of the data that the vector holds.
Member Typedef Documentation
typedef const T* Dali::Vector< T, IsTrivialType >::ConstIterator |
Const iterator.
- Since :
- 2.4
typedef T Dali::Vector< T, IsTrivialType >::ItemType |
Item type.
- Since :
- 2.4
typedef T* Dali::Vector< T, IsTrivialType >::Iterator |
Most simple Iterator is a pointer.
- Since :
- 2.4
typedef VectorBase::SizeType Dali::Vector< T, IsTrivialType >::SizeType |
Type definitions.
- Since :
- 2.4 Size type
- Since :
- 2.4
Reimplemented from Dali::VectorAlgorithms< IsTrivialType >.
Constructor & Destructor Documentation
Dali::Vector< T, IsTrivialType >::Vector | ( | ) |
Default constructor. Does not allocate any space.
- Since :
- 2.4
Dali::Vector< T, IsTrivialType >::~Vector | ( | ) |
Destructor. Releases the allocated space.
- Since :
- 2.4
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 :
- 2.4
- Returns:
- Iterator to the beginning of the data.
void Dali::Vector< T, IsTrivialType >::Clear | ( | ) |
Clear the contents of the vector. Keeps its capacity.
- Since :
- 2.4
Reimplemented from Dali::VectorAlgorithms< IsTrivialType >.
Iterator Dali::Vector< T, IsTrivialType >::End | ( | ) | const |
Iterator to the end of the data (one past last element).
- Since :
- 2.4
- Returns:
- Iterator to the end of the data (one past last element).
Iterator Dali::Vector< T, IsTrivialType >::Erase | ( | Iterator | iterator | ) |
Erase an element.
Does not change capacity. Other elements get moved.
- Since :
- 2.4
- Parameters:
-
[in] iterator Iterator pointing to 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 | ||
) |
Erase a range of elements.
Does not change capacity. Other elements get moved.
- Since :
- 2.4
- 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 | ||
) |
Insert 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.
- Precondition:
- Iterator at must be in the vector's range ( Vector::Begin(), Vector::End() ).
- Parameters:
-
[in] at Iterator where to insert the elements into the vector. [in] element An element to be added.
- Since :
- 2.4
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 :
- 2.4
- 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 :
- 2.4
- Parameters:
-
[in] vector Vector to assign from.
- Returns:
- Reference to self for chaining.
ItemType& Dali::Vector< T, IsTrivialType >::operator[] | ( | SizeType | index | ) |
Subscript operator.
- Since :
- 2.4
- 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 :
- 2.4
- Parameters:
-
[in] 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 | ) |
Push 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 :
- 2.4
- Parameters:
-
[in] element Element to be added.
void Dali::Vector< T, IsTrivialType >::Release | ( | ) |
Release the memory that the vector holds.
- Since :
- 2.4
Reimplemented from Dali::VectorAlgorithms< IsTrivialType >.
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 :
- 2.4
- Parameters:
-
[in] iterator Iterator pointing to 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 | ) |
Reserve space in the vector.
Reserving less than current Capacity is a no-op.
- Since :
- 2.4
- Parameters:
-
[in] count Count of elements to reserve.
void Dali::Vector< T, IsTrivialType >::Resize | ( | SizeType | count, |
ItemType | item = ItemType() |
||
) |
Resize the vector. Does not change capacity.
- Since :
- 2.4
- 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 | ) |