torque Torque Game Engine Documentation
TGE Version 1.5.2

Vector< T > Class Template Reference

#include <tVector.h>

Inheritance diagram for Vector< T >:

Inheritance graph
[legend]

Detailed Description


template<class T> class Vector< T >

A dynamic array class.

The vector grows as you insert or append elements. Insertion is fastest at the end of the array. Resizing of the array can be avoided by pre-allocating space using the reserve() method.

***WARNING***

This template does not initialize, construct or destruct any of it's elements. This means don't use this template for elements (classes) that need these operations. This template is intended to be used for simple structures that have no constructors or destructors.


STL interface

typedef T value_type
typedef T & reference
typedef const T & const_reference
typedef T * iterator
typedef const T * const_iterator
typedef S32 difference_type
typedef U32 size_type
Vector< T > & operator= (const Vector< T > &p)
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
S32 size () const
bool empty () const
void insert (iterator, const T &)
void erase (iterator)
T & front ()
const T & front () const
T & back ()
const T & back () const
void push_front (const T &)
void push_back (const T &)
void pop_front ()
void pop_back ()
T & operator[] (U32)
const T & operator[] (U32) const
T & operator[] (S32 i)
const T & operator[] (S32 i) const
void reserve (U32)
U32 capacity () const

Extended interface

U32 memSize () const
T * address () const
U32 setSize (U32)
void increment (U32=1)
void decrement (U32=1)
void insert (U32)
void erase (U32)
void erase_fast (U32)
void erase_fast (iterator)
void clear ()
void compact ()
T & first ()
T & last ()
const T & first () const
const T & last () const
void set (void *addr, U32 sz)
void merge (const Vector &p)
 Merge another vector into this one.

Public Member Functions

 Vector (const U32 initialSize=0)
 Vector (const U32 initialSize, const char *fileName, const U32 lineNum)
 Vector (const char *fileName, const U32 lineNum)
 Vector (const Vector &)
 ~Vector ()

Protected Member Functions

bool resize (U32)

Protected Attributes

U32 mElementCount
U32 mArraySize
T * mArray


Member Typedef Documentation


Constructor & Destructor Documentation

template<class T>
Vector< T >::Vector ( const U32  initialSize = 0  )  [inline]

template<class T>
Vector< T >::Vector ( const U32  initialSize,
const char *  fileName,
const U32  lineNum 
) [inline]

template<class T>
Vector< T >::Vector ( const char *  fileName,
const U32  lineNum 
) [inline]

template<class T>
Vector< T >::Vector ( const Vector< T > &   )  [inline]

template<class T>
Vector< T >::~Vector (  )  [inline]


Member Function Documentation

template<class T>
bool Vector< T >::resize ( U32   )  [inline, protected]

template<class T>
Vector< T > & Vector< T >::operator= ( const Vector< T > &  p  )  [inline]

template<class T>
S32 Vector< T >::size (  )  const [inline]

template<class T>
bool Vector< T >::empty (  )  const [inline]

template<class T>
void Vector< T >::insert ( iterator  ,
const T &   
) [inline]

template<class T>
void Vector< T >::erase ( iterator   )  [inline]

template<class T>
void Vector< T >::push_front ( const T &   )  [inline]

template<class T>
void Vector< T >::push_back ( const T &   )  [inline]

template<class T>
void Vector< T >::pop_front (  )  [inline]

template<class T>
void Vector< T >::pop_back (  )  [inline]

template<class T>
T& Vector< T >::operator[] ( S32  i  )  [inline]

template<class T>
const T& Vector< T >::operator[] ( S32  i  )  const [inline]

template<class T>
void Vector< T >::reserve ( U32   )  [inline]

template<class T>
U32 Vector< T >::capacity (  )  const [inline]

template<class T>
U32 Vector< T >::memSize (  )  const [inline]

template<class T>
T * Vector< T >::address (  )  const [inline]

template<class T>
U32 Vector< T >::setSize ( U32   )  [inline]

template<class T>
void Vector< T >::increment ( U32  = 1  )  [inline]

template<class T>
void Vector< T >::decrement ( U32  = 1  )  [inline]

template<class T>
void Vector< T >::insert ( U32   )  [inline]

template<class T>
void Vector< T >::erase ( U32   )  [inline]

template<class T>
void Vector< T >::erase_fast ( iterator   )  [inline]

template<class T>
void Vector< T >::clear (  )  [inline]

template<class T>
void Vector< T >::compact (  )  [inline]

template<class T>
void Vector< T >::set ( void addr,
U32  sz 
) [inline]

template<class T>
void Vector< T >::merge ( const Vector< T > &  p  )  [inline]

Merge another vector into this one.

Author:
BJW 8/20/97


Field Documentation

template<class T>
U32 Vector< T >::mElementCount [protected]

template<class T>
U32 Vector< T >::mArraySize [protected]

template<class T>
T* Vector< T >::mArray [protected]




All Rights Reserved GarageGames.com, Inc. 1999-2005
Auto-magically Generated with Doxygen