Torque2D Reference
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Vector< T > Class Template Reference

#include <platformFont.h>

+ Inheritance diagram for Vector< T >:

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 ()
 
void setFileAssociation (const char *file, const U32 line)
 

Protected Member Functions

bool resize (U32)
 
void destroy (U32 start, U32 end)
 Destructs elements from start to end-1 More...
 
void construct (U32 start, U32 end)
 Constructs elements from start to end-1 More...
 
void construct (U32 start, U32 end, const T *array)
 

Protected Attributes

U32 mElementCount
 
U32 mArraySize
 
T * mArray
 
const char * mFileAssociation
 
U32 mLineAssociation
 

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
 
typedef difference_type(QSORT_CALLBACK * compare_func )(const T *a, const T *b)
 
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
 
bool contains (const T &) 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 &)
 
U32 push_front_unique (const T &)
 
U32 push_back_unique (const T &)
 
S32 find_next (const T &, U32 start=0) const
 
void pop_front ()
 
void pop_back ()
 
T & operator[] (U32)
 
const T & operator[] (U32) const
 
T & operator[] (S32 i)
 
const T & operator[] (S32 i) const
 
T & at (U32)
 
const T & at (U32) const
 
void reserve (U32)
 
U32 capacity () const
 

Extended interface

U32 memSize () const
 
T * address () const
 
U32 setSize (U32)
 
void increment (U32=1)
 
void increment (const T *array, U32=1)
 
void decrement (U32=1)
 
void insert (U32)
 
void erase (U32)
 
void erase_fast (U32)
 
void erase_fast (iterator)
 
void clear ()
 
void compact ()
 
void sort (compare_func f)
 
T & first ()
 
T & last ()
 
const T & first () const
 
const T & last () const
 
void set (void *addr, U32 sz)
 
void merge (const Vector &p)
 

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.

Member Typedef Documentation

typedef difference_type(QSORT_CALLBACK * compare_func)(const T *a, const T *b)
typedef const T* const_iterator
typedef const T& const_reference
typedef S32 difference_type
typedef T* iterator
typedef T& reference
typedef U32 size_type
typedef T value_type

Constructor & Destructor Documentation

Vector ( const U32  initialSize = 0)
inline
Vector ( const U32  initialSize,
const char *  fileName,
const U32  lineNum 
)
inline
Vector ( const char *  fileName,
const U32  lineNum 
)
inline
Vector ( const Vector< T > &  p)
inline
~Vector ( )
inline

Member Function Documentation

T * address ( ) const
inline
T & at ( U32  index)
inline
const T & at ( U32  index) const
inline
T & back ( )
inline
const T & back ( ) const
inline
Vector< T >::iterator begin ( )
inline
Vector< T >::const_iterator begin ( ) const
inline
U32 capacity ( ) const
inline
void clear ( )
inline
void compact ( )
inline
void construct ( U32  start,
U32  end 
)
inlineprotected

Constructs elements from start to end-1

void construct ( U32  start,
U32  end,
const T *  array 
)
inlineprotected
bool contains ( const T &  ) const
void decrement ( U32  delta = 1)
inline
void destroy ( U32  start,
U32  end 
)
inlineprotected

Destructs elements from start to end-1

bool empty ( ) const
inline
Vector< T >::iterator end ( void  )
inline
Vector< T >::const_iterator end ( void  ) const
inline
void erase ( iterator  q)
inline
void erase ( U32  index)
inline
void erase_fast ( U32  index)
inline
void erase_fast ( iterator  q)
inline
S32 find_next ( const T &  x,
U32  start = 0 
) const
inline
T & first ( )
inline
const T & first ( ) const
inline
T & front ( )
inline
const T & front ( ) const
inline
void increment ( U32  delta = 1)
inline
void increment ( const T *  array,
U32  delta = 1 
)
inline
void insert ( iterator  p,
const T &  x 
)
inline
void insert ( U32  index)
inline
T & last ( )
inline
const T & last ( ) const
inline
U32 memSize ( ) const
inline
void merge ( const Vector< T > &  p)
inline
Vector< T > & operator= ( const Vector< T > &  p)
inline
T & operator[] ( U32  index)
inline
const T & operator[] ( U32  index) const
inline
T& operator[] ( S32  i)
inline
const T& operator[] ( S32  i) const
inline
void pop_back ( )
inline
void pop_front ( )
inline
void push_back ( const T &  x)
inline
U32 push_back_unique ( const T &  x)
inline
void push_front ( const T &  x)
inline
U32 push_front_unique ( const T &  x)
inline
void reserve ( U32  size)
inline
bool resize ( U32  ecount)
inlineprotected
void set ( void *  addr,
U32  sz 
)
inline
void setFileAssociation ( const char *  file,
const U32  line 
)
inline
U32 setSize ( U32  size)
inline
S32 size ( ) const
inline
void sort ( compare_func  f)
inline

Member Data Documentation

T* mArray
protected
U32 mArraySize
protected
U32 mElementCount
protected
const char* mFileAssociation
protected
U32 mLineAssociation
protected

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