Torque2D Reference
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Vector< T > Class Template Reference

#include <vector.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
 
void construct (U32 start, U32 end)
 Constructs elements from start to end-1
 
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

◆ compare_func

template<class T >
typedef difference_type(QSORT_CALLBACK * compare_func) (const T *a, const T *b)

◆ const_iterator

template<class T >
typedef const T* const_iterator

◆ const_reference

template<class T >
typedef const T& const_reference

◆ difference_type

template<class T >
typedef S32 difference_type

◆ iterator

template<class T >
typedef T* iterator

◆ reference

template<class T >
typedef T& reference

◆ size_type

template<class T >
typedef U32 size_type

◆ value_type

template<class T >
typedef T value_type

Constructor & Destructor Documentation

◆ Vector() [1/4]

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

◆ Vector() [2/4]

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

◆ Vector() [3/4]

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

◆ Vector() [4/4]

template<class T >
Vector ( const Vector< T > &  p)
inline

◆ ~Vector()

template<class T >
~Vector ( )
inline

Member Function Documentation

◆ address()

template<class T >
T * address ( ) const
inline

◆ at() [1/2]

template<class T >
T & at ( U32  index)
inline

◆ at() [2/2]

template<class T >
const T & at ( U32  index) const
inline

◆ back() [1/2]

template<class T >
T & back ( )
inline

◆ back() [2/2]

template<class T >
const T & back ( ) const
inline

◆ begin() [1/2]

template<class T >
Vector< T >::iterator begin ( )
inline

◆ begin() [2/2]

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

◆ capacity()

template<class T >
U32 capacity ( ) const
inline

◆ clear()

template<class T >
void clear ( )
inline

◆ compact()

template<class T >
void compact ( )
inline

◆ construct() [1/2]

template<class T >
void construct ( U32  start,
U32  end 
)
inlineprotected

Constructs elements from start to end-1

◆ construct() [2/2]

template<class T >
void construct ( U32  start,
U32  end,
const T *  array 
)
inlineprotected

◆ contains()

template<class T >
bool contains ( const T &  t) const
inline

◆ decrement()

template<class T >
void decrement ( U32  delta = 1)
inline

◆ destroy()

template<class T >
void destroy ( U32  start,
U32  end 
)
inlineprotected

Destructs elements from start to end-1

◆ empty()

template<class T >
bool empty ( ) const
inline

◆ end() [1/2]

template<class T >
Vector< T >::iterator end ( )
inline

◆ end() [2/2]

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

◆ erase() [1/2]

template<class T >
void erase ( iterator  q)
inline

◆ erase() [2/2]

template<class T >
void erase ( U32  index)
inline

◆ erase_fast() [1/2]

template<class T >
void erase_fast ( iterator  q)
inline

◆ erase_fast() [2/2]

template<class T >
void erase_fast ( U32  index)
inline

◆ find_next()

template<class T >
S32 find_next ( const T &  x,
U32  start = 0 
) const
inline

◆ first() [1/2]

template<class T >
T & first ( )
inline

◆ first() [2/2]

template<class T >
const T & first ( ) const
inline

◆ front() [1/2]

template<class T >
T & front ( )
inline

◆ front() [2/2]

template<class T >
const T & front ( ) const
inline

◆ increment() [1/2]

template<class T >
void increment ( const T *  array,
U32  delta = 1 
)
inline

◆ increment() [2/2]

template<class T >
void increment ( U32  delta = 1)
inline

◆ insert() [1/2]

template<class T >
void insert ( iterator  p,
const T &  x 
)
inline

◆ insert() [2/2]

template<class T >
void insert ( U32  index)
inline

◆ last() [1/2]

template<class T >
T & last ( )
inline

◆ last() [2/2]

template<class T >
const T & last ( ) const
inline

◆ memSize()

template<class T >
U32 memSize ( ) const
inline

◆ merge()

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

◆ operator=()

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

◆ operator[]() [1/4]

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

◆ operator[]() [2/4]

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

◆ operator[]() [3/4]

template<class T >
T & operator[] ( U32  index)
inline

◆ operator[]() [4/4]

template<class T >
const T & operator[] ( U32  index) const
inline

◆ pop_back()

template<class T >
void pop_back ( )
inline

◆ pop_front()

template<class T >
void pop_front ( )
inline

◆ push_back()

template<class T >
void push_back ( const T &  x)
inline

◆ push_back_unique()

template<class T >
U32 push_back_unique ( const T &  x)
inline

◆ push_front()

template<class T >
void push_front ( const T &  x)
inline

◆ push_front_unique()

template<class T >
U32 push_front_unique ( const T &  x)
inline

◆ reserve()

template<class T >
void reserve ( U32  size)
inline

◆ resize()

template<class T >
bool resize ( U32  ecount)
inlineprotected

◆ set()

template<class T >
void set ( void *  addr,
U32  sz 
)
inline

◆ setFileAssociation()

template<class T >
void setFileAssociation ( const char *  file,
const U32  line 
)
inline

◆ setSize()

template<class T >
U32 setSize ( U32  size)
inline

◆ size()

template<class T >
S32 size ( ) const
inline

◆ sort()

template<class T >
void sort ( compare_func  f)
inline

Member Data Documentation

◆ mArray

template<class T >
T* mArray
protected

◆ mArraySize

template<class T >
U32 mArraySize
protected

◆ mElementCount

template<class T >
U32 mElementCount
protected

◆ mFileAssociation

template<class T >
const char* mFileAssociation
protected

◆ mLineAssociation

template<class T >
U32 mLineAssociation
protected

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