C4 Engine Terathon Software C4 Engine API Documentation

• Utility Library

API Links
Developer Links

class List

Defined in:  C4List.h
The List class encapsulates a doubly-linked list.
Definition

template <class type> class List : public ListBase

Member Functions
List::First Returns the first element in a list.
List::Last Returns the last element in a list.
List::Member Returns a boolean value indicating whether a particular object is a member of a list.
List::Empty Returns a boolean value indicating whether a list is empty.
List::GetElementCount Returns the number of elements in a list.
List::Prepend Adds an object to the beginning of a list.
List::Append Adds an object to the end of a list.
List::InsertBefore Inserts an object before an existing element of a list.
List::InsertAfter Inserts an object after an existing element of a list.
List::Remove Removes a particular element from a list.
List::RemoveAll Removes all elements from a list.
List::Purge Deletes all elements in a list.
Template Parameters
type The type of the class that can be stored in the list. The class specified by this parameter should inherit directly from the ListElement class using the same template parameter.
Constructor

List();

Description
The List class template is a container used to store a homogeneous doubly-linked list of objects. The class type of objects that are to be stored in the list must be a subclass of the ListElement class template using the same template parameter as the List container. A particular object can be a member of only one list at a time.

Upon construction, a List object is empty. When a List object is destroyed, all of the members of the list are also destroyed. To avoid deleting the members of a list when a List object is destroyed, first call the List::RemoveAll function to remove all of the list's members.
Overloaded Operators
type *operator [](long index) const; Returns the element of a list whose zero-based index is index. If index is greater than or equal to the number of elements in the list, then the return value is nullptr.
Base Classes
ListBase Used internally to encapsulate common functionality that is independent of the template parameter.
See Also

ListElement