Vector

Engine/source/core/util/tVector.h

A dynamic array template class.

More...

STL interface

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

Extended interface

T *
erase(U32 index, U32 count)
fill(const T & value)
bool

Finds the first matching element and erases it.

T &
T &
last()
const T &
last()
set(void * addr, U32 sz)

Appends the content of the vector to this one.

merge(const T * addr, U32 count)

Appends the content of the array to the vector.

Public Friends

Protected Attributes

T *

Pointer to the Vector elements.

Number of elements allocated for the Vector.

Number of elements currently in the Vector.

Protected Functions

construct(U32 start, U32 end)

Constructs elements from start to end-1

construct(U32 start, U32 end, const T * array)
destroy(U32 start, U32 end)

Destructs elements from start to end-1

bool

Public Functions

Vector(const char * fileName, const U32 lineNum)
Vector(const U32 initialSize, const char * fileName, const U32 lineNum)
Vector(const U32 initialSize)

Detailed Description

A dynamic array template 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.

STL interface

operator=(const Vector< T > & p)

begin()

begin()

end()

end()

size()

empty()

contains(const T & )

insert(iterator , const T & )

erase(iterator )

front()

front()

back()

back()

push_front(const T & )

push_back(const T & )

push_front_unique(const T & )

push_back_unique(const T & )

find_next(const T & , U32 start)

pop_front()

pop_back()

operator[](U32 )

operator[](U32 )

operator[](S32 i)

operator[](S32 i)

reserve(U32 )

capacity()

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)

Extended interface

memSize()

address()

setSize(U32 )

increment()

decrement()

increment(U32 )

decrement(U32 )

insert(U32 )

insert(U32 , const T & )

erase(U32 )

erase_fast(U32 )

erase(U32 index, U32 count)

erase_fast(iterator )

clear()

compact()

sort(compare_func f)

fill(const T & value)

remove(const T & )

Finds the first matching element and erases it.


return:

Returns true if a match is found.

first()

last()

first()

last()

set(void * addr, U32 sz)

merge(const Vector & p)

Appends the content of the vector to this one.

merge(const T * addr, U32 count)

Appends the content of the array to the vector.

Parameters:

addr

A pointer to the first item of the array to merge.

count

The number of elements in the array to merge.

reverse()

Public Friends

Protected Attributes

T * mArray 

Pointer to the Vector elements.

U32 mArraySize 

Number of elements allocated for the Vector.

U32 mElementCount 

Number of elements currently in the Vector.

Protected Functions

construct(U32 start, U32 end)

Constructs elements from start to end-1

construct(U32 start, U32 end, const T * array)

destroy(U32 start, U32 end)

Destructs elements from start to end-1

resize(U32 )

Public Functions

Vector(const char * fileName, const U32 lineNum)

Vector(const U32 initialSize, const char * fileName, const U32 lineNum)

Vector(const U32 initialSize)

Vector(const Vector & )

~Vector()