Vector template class for POD types. Does not call constructors or destructors and uses block move. Is intentionally (for performance reasons) unsafe for self-insertion. More...

#include <Urho3D/Container/Vector.h>

Inheritance diagram for Urho3D::PODVector< T >:
[legend]
Collaboration diagram for Urho3D::PODVector< T >:
[legend]

Public Types

typedef T ValueType
 
typedef RandomAccessIterator< T > Iterator
 
typedef
RandomAccessConstIterator< T > 
ConstIterator
 

Public Member Functions

 PODVector ()
 Construct empty.
 
 PODVector (unsigned size)
 Construct with initial size.
 
 PODVector (unsigned size, const T &value)
 Construct with initial size and default value.
 
 PODVector (const T *data, unsigned size)
 Construct with initial data.
 
 PODVector (const PODVector< T > &vector)
 Construct from another vector.
 
 ~PODVector ()
 Destruct.
 
PODVector< T > & operator= (const PODVector< T > &rhs)
 Assign from another vector.
 
PODVector< T > & operator+= (const T &rhs)
 Add-assign an element.
 
PODVector< T > & operator+= (const PODVector< T > &rhs)
 Add-assign another vector.
 
PODVector< T > operator+ (const T &rhs) const
 Add an element.
 
PODVector< T > operator+ (const PODVector< T > &rhs) const
 Add another vector.
 
bool operator== (const PODVector< T > &rhs) const
 Test for equality with another vector.
 
bool operator!= (const PODVector< T > &rhs) const
 Test for inequality with another vector.
 
T & operator[] (unsigned index)
 Return element at index.
 
const T & operator[] (unsigned index) const
 Return const element at index.
 
T & At (unsigned index)
 Return element at index.
 
const T & At (unsigned index) const
 Return const element at index.
 
void Push (const T &value)
 Add an element at the end.
 
void Push (const PODVector< T > &vector)
 Add another vector at the end.
 
void Pop ()
 Remove the last element.
 
void Insert (unsigned pos, const T &value)
 Insert an element at position.
 
void Insert (unsigned pos, const PODVector< T > &vector)
 Insert another vector at position.
 
Iterator Insert (const Iterator &dest, const T &value)
 Insert an element by iterator.
 
Iterator Insert (const Iterator &dest, const PODVector< T > &vector)
 Insert a vector by iterator.
 
Iterator Insert (const Iterator &dest, const ConstIterator &start, const ConstIterator &end)
 Insert a vector partially by iterators.
 
Iterator Insert (const Iterator &dest, const T *start, const T *end)
 Insert elements.
 
void Erase (unsigned pos, unsigned length=1)
 Erase a range of elements.
 
Iterator Erase (const Iterator &it)
 Erase an element by iterator. Return iterator to the next element.
 
Iterator Erase (const Iterator &start, const Iterator &end)
 Erase a range by iterators. Return iterator to the next element.
 
void EraseSwap (unsigned pos, unsigned length=1)
 Erase a range of elements by swapping elements from the end of the array.
 
bool Remove (const T &value)
 Erase an element by value. Return true if was found and erased.
 
bool RemoveSwap (const T &value)
 Erase an element by value by swapping with the last element. Return true if was found and erased.
 
void Clear ()
 Clear the vector.
 
void Resize (unsigned newSize)
 Resize the vector.
 
void Reserve (unsigned newCapacity)
 Set new capacity.
 
void Compact ()
 Reallocate so that no extra memory is used.
 
Iterator Find (const T &value)
 Return iterator to value, or to the end if not found.
 
ConstIterator Find (const T &value) const
 Return const iterator to value, or to the end if not found.
 
unsigned IndexOf (const T &value) const
 Return index of value in vector, or size if not found.
 
bool Contains (const T &value) const
 Return whether contains a specific value.
 
Iterator Begin ()
 Return iterator to the beginning.
 
ConstIterator Begin () const
 Return const iterator to the beginning.
 
Iterator End ()
 Return iterator to the end.
 
ConstIterator End () const
 Return const iterator to the end.
 
T & Front ()
 Return first element.
 
const T & Front () const
 Return const first element.
 
T & Back ()
 Return last element.
 
const T & Back () const
 Return const last element.
 
unsigned Size () const
 Return number of elements.
 
unsigned Capacity () const
 Return capacity of vector.
 
bool Empty () const
 Return whether vector is empty.
 
T * Buffer () const
 Return the buffer with right type.
 
- Public Member Functions inherited from Urho3D::VectorBase
 VectorBase ()
 Construct.
 
void Swap (VectorBase &rhs)
 Swap with another vector.
 

Private Member Functions

void MoveRange (unsigned dest, unsigned src, unsigned count)
 Move a range of elements within the vector.
 

Static Private Member Functions

static void CopyElements (T *dest, const T *src, unsigned count)
 Copy elements from one buffer to another.
 

Additional Inherited Members

- Static Protected Member Functions inherited from Urho3D::VectorBase
static unsigned char * AllocateBuffer (unsigned size)
 
- Protected Attributes inherited from Urho3D::VectorBase
unsigned size_
 Size of vector.
 
unsigned capacity_
 Buffer capacity.
 
unsigned char * buffer_
 Buffer.
 

Detailed Description

template<class T>
class Urho3D::PODVector< T >

Vector template class for POD types. Does not call constructors or destructors and uses block move. Is intentionally (for performance reasons) unsafe for self-insertion.


The documentation for this class was generated from the following file:
  • Source/Urho3D/Container/Vector.h