The Pedigree Project  0.1
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Vector< T > Class Template Reference

A vector / dynamic array. More...

#include <Vector.h>

+ Inheritance diagram for Vector< T >:
+ Collaboration diagram for Vector< T >:

Classes

struct  ReverseIteratorContainer
 

Public Types

typedef T * Iterator
 
typedef T const * ConstIterator
 
typedef ReverseIteratorContainer< T * > ReverseIterator
 
typedef ReverseIteratorContainer< const T * > ConstReverseIterator
 

Public Member Functions

 Vector ()
 
 Vector (size_t size)
 
 Vector (const Vector &x)
 
 ~Vector ()
 
Vectoroperator= (const Vector &x)
 
T & operator[] (size_t index) const
 
size_t size () const
 
size_t count () const
 
void pushBack (const T &value)
 
popBack ()
 
void pushFront (const T &value)
 
popFront ()
 
void setAt (size_t idx, const T &value)
 
void swap (Iterator a, Iterator b)
 
void insert (size_t index, const T &value)
 
void clear (bool freeMem=false)
 
void erase (size_t index)
 
Iterator erase (Iterator iter)
 
ReverseIterator erase (ReverseIterator iter)
 
Iterator begin ()
 
ConstIterator begin () const
 
Iterator end ()
 
ConstIterator end () const
 
ReverseIterator rbegin ()
 
ConstReverseIterator rbegin () const
 
ReverseIterator rend ()
 
ConstReverseIterator rend () const
 
void assign (const Vector &x)
 
void reserve (size_t size, bool copy)
 

Private Member Functions

void reserve (size_t size, bool copy, bool free)
 

Private Attributes

size_t m_Size
 
size_t m_Count
 
size_t m_Start
 
T * m_Data
 

Static Private Attributes

static const int m_ReserveFactor = 2
 

Detailed Description

template<class T>
class Vector< T >

A vector / dynamic array.

General Vector template class, aka dynamic array

Definition at line 34 of file Ext2Filesystem.h.

Member Typedef Documentation

template<class T>
typedef T const* Vector< T >::ConstIterator

Contant random-access iterator for the Vector

Definition at line 39 of file Vector.h.

template<class T>
typedef T* Vector< T >::Iterator

Random-access iterator for the Vector

Definition at line 37 of file Vector.h.

Member Function Documentation

template<class T>
Iterator Vector< T >::begin ( )
inline
template<class T>
ConstIterator Vector< T >::begin ( ) const
inline

Get a constant iterator pointing to the beginning of the Vector

Returns
constant iterator pointing to the beginning of the Vector

Definition at line 154 of file Vector.h.

template<class T>
Iterator Vector< T >::end ( )
inline
template<class T>
ConstIterator Vector< T >::end ( ) const
inline

Get a constant iterator pointing to the last element + 1

Returns
constant iterator pointing to the last element + 1

Definition at line 166 of file Vector.h.

Member Data Documentation

template<class T>
size_t Vector< T >::m_Count
private
template<class T>
T* Vector< T >::m_Data
private
template<class T>
const int Vector< T >::m_ReserveFactor = 2
staticprivate

Factor to multiply by in reserve().

Definition at line 213 of file Vector.h.

Referenced by Vector< T >::reserve().

template<class T>
size_t Vector< T >::m_Size
private

The number of elements we have reserved space for

Definition at line 202 of file Vector.h.

Referenced by Vector< T >::clear(), Vector< T >::pushBack(), Vector< T >::reserve(), and Vector< T >::size().

template<class T>
size_t Vector< T >::m_Start
private

The current start index in the array. This is used to reduce the need to keep copying the array contents.

Definition at line 209 of file Vector.h.

Referenced by Vector< T >::assign(), Vector< T >::clear(), Vector< T >::erase(), Vector< T >::insert(), Vector< T >::operator[](), Vector< T >::popBack(), Vector< T >::popFront(), Vector< T >::pushBack(), Vector< T >::pushFront(), Vector< T >::reserve(), and Vector< T >::setAt().


The documentation for this class was generated from the following files: