Torque::List

Engine/source/core/util/tList.h

A list template class.

More...

Classes:

class

Used instead of a (void *) for type-safety of persistent iterators.

Public Types

ConstIterator 
ConstReference 
DifferenceType 
_Iterator< Type, Link >
Iterator 
PrivatePersist *
PersistentIter 

A PersistentIter is used for the special cases where you need to store an iterator for efficiency reasons.

Type &
Reference 
SizeType 
ValueType 

Private Attributes

Public Functions

List()

_Iterator to first element

_Iterator to first element

Empty the List.

end()

_Iterator to last element + 1

end()

_Iterator to last element + 1

Preserves element order.

Preserves element order.

Type &

First element.

First element.

Return the number of elements.

Insert at the given iter.

insert(U32 index, const Type & )

Insert new element at the given index.

bool

Node count == 0?

Type &
last()

Last element.

last()

Last element.

Remove the last element.

Remove the first element.

Insert after the last element.

Insert at first element.

_Iterator to first element - 1

_Iterator to first element - 1

rend()

_Iterator to last element

rend()

_Iterator to last element

Set the list size.

Private Functions

Link *
_node(U32 index)

Detailed Description

A list template class.

A classic list class similar to the STL list class. The list class supports fast insert and erase operations, but slow dynamic access. The list is circular and the iterator supports iterating past the end() or rend() in order to loop around.

Public Types

typedef _Iterator< const Type, const Link > ConstIterator 
typedef const Type & ConstReference 
typedef S32 DifferenceType 
typedef _Iterator< Type, Link > Iterator 
typedef PrivatePersist * PersistentIter 

A PersistentIter is used for the special cases where you need to store an iterator for efficiency reasons.

The _Iterator class handles the conversion to/from PersistentIter.

note:

The data in the node this points to could go away, so only use these in cases where you control the allocation/deallocation of the nodes in the list.

typedef Type & Reference 
typedef U32 SizeType 
typedef Type ValueType 

Private Attributes

Link _head 
U32 _size 

Public Functions

List()

List(const List & p)

~List()

begin()

_Iterator to first element

begin()

_Iterator to first element

clear()

Empty the List.

end()

_Iterator to last element + 1

end()

_Iterator to last element + 1

erase(Iterator )

Preserves element order.

erase(U32 )

Preserves element order.

first()

First element.

first()

First element.

getSize()

Return the number of elements.

insert(Iterator , const Type & )

Insert at the given iter.

insert(U32 index, const Type & )

Insert new element at the given index.

isEmpty()

Node count == 0?

last()

Last element.

last()

Last element.

operator=(const List & p)

operator[](U32 )

operator[](U32 )

popBack()

Remove the last element.

popFront()

Remove the first element.

pushBack(const Type & )

Insert after the last element.

pushFront(const Type & )

Insert at first element.

rbegin()

_Iterator to first element - 1

rbegin()

_Iterator to first element - 1

rend()

_Iterator to last element

rend()

_Iterator to last element

resize(U32 )

Set the list size.

Private Functions

_destroy()

_node(U32 index)