Tizen Native API  5.5
Dali::Vector< T, IsTrivialType > Class Template Reference

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.
Vectoroperator= (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
ItemTypeoperator[] (SizeType index)
 Subscript operator.
const ItemTypeoperator[] (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:
typeThe type of the data that the vector holds

Member Typedef Documentation

template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
typedef const T* Dali::Vector< T, IsTrivialType >::ConstIterator

Const iterator.

Since:
3.0, DALi version 1.0.0
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
typedef T Dali::Vector< T, IsTrivialType >::ItemType

Item type.

Since:
3.0, DALi version 1.0.0
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
typedef T* Dali::Vector< T, IsTrivialType >::Iterator

Most simple Iterator is a pointer.

Since:
3.0, DALi version 1.0.0
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
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

template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
anonymous enum

Enumeration for BaseType.

Since:
3.0, DALi version 1.0.0
Enumerator:
BaseType 
Since:
3.0, DALi version 1.0.0

Constructor & Destructor Documentation

template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
Dali::Vector< T, IsTrivialType >::Vector ( )

Default constructor. Does not allocate any space.

Since:
3.0, DALi version 1.0.0
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
Dali::Vector< T, IsTrivialType >::~Vector ( )

Destructor. Releases the allocated space.

Since:
3.0, DALi version 1.0.0
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
Dali::Vector< T, IsTrivialType >::Vector ( const Vector< T, IsTrivialType > &  vector)

Copy constructor.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]vectorVector to copy from

Member Function Documentation

template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
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
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
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
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
void Dali::Vector< T, IsTrivialType >::Clear ( )

Clears the contents of the vector. Keeps its capacity.

Since:
3.0, DALi version 1.0.0
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
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)
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
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
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
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]iteratorIterator 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 ).
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
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]firstIterator to the first element to be erased
[in]lastIterator 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.
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
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]atIterator where to insert the elements into the vector
[in]elementAn element to be added
Precondition:
Iterator at must be in the vector's range ( Vector::Begin(), Vector::End() ).
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
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]atIterator where to insert the elements into the vector
[in]fromIterator to the first element to be inserted
[in]toIterator 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.
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
Vector& Dali::Vector< T, IsTrivialType >::operator= ( const Vector< T, IsTrivialType > &  vector)

Assignment operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]vectorVector to assign from
Returns:
Reference to self for chaining
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
ItemType& Dali::Vector< T, IsTrivialType >::operator[] ( SizeType  index)

Subscript operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]indexIndex of the element
Returns:
Reference to the element for given index
Precondition:
Index must be in the vector's range.
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
const ItemType& Dali::Vector< T, IsTrivialType >::operator[] ( SizeType  index) const

Subscript operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]indexIndex of the element
Returns:
Reference to the element for given index
Precondition:
Index must be in the vector's range.
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
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]elementElement to be added
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
void Dali::Vector< T, IsTrivialType >::Release ( )

Releases the memory that the vector holds.

Since:
3.0, DALi version 1.0.0
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
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]iteratorIterator pointing to the item to remove
Precondition:
Iterator iterator must be in the vector's range ( Vector::Begin(), Vector::End() - 1 ).
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
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]countCount of elements to reserve
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
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]countCount to resize to
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
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]countCount to resize to
[in]itemAn item to insert to the new indices
template<class T, bool IsTrivialType = TypeTraits<T>::IS_TRIVIAL_TYPE == true>
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]vectorVector to swap with