Plasma Engine  2.0
Loading...
Searching...
No Matches
plListBase< T > Class Template Reference

A List-class, similar to STL::list. More...

#include <List.h>

Inheritance diagram for plListBase< T >:

Classes

struct  Iterator
 A forward-iterator. Allows sequential access from front-to-back. More...
 

Public Member Functions

void Clear ()
 Clears the list, afterwards it is empty.
 
void Compact ()
 See plDeque::Compact()
 
plUInt32 GetCount () const
 Returns the number of elements in the list. O(1) operation.
 
bool IsEmpty () const
 Returns whether size == 0. O(1) operation.
 
const T & PeekFront () const
 Returns the very first element in the list.
 
const T & PeekBack () const
 Returns the very last element in the list.
 
T & PeekFront ()
 Returns the very first element in the list.
 
T & PeekBack ()
 Returns the very last element in the list.
 
T & PushBack ()
 Appends a default-constructed element to the list and returns a reference to it.
 
void PushBack (const T &element)
 Appends a copy of the given element to the list.
 
void PopBack ()
 Removes the very last element from the list.
 
T & PushFront ()
 Appends a default-constructed element to the front of the list and returns a reference to it.
 
void PushFront (const T &element)
 Appends a copy of the given element to the front of the list.
 
void PopFront ()
 Removes the very first element from the list.
 
void SetCount (plUInt32 uiNewSize)
 Sets the number of elements that are in the list.
 
Iterator Insert (const Iterator &pos, const T &data)
 Inserts one element before the position defined by the iterator.
 
void Insert (const Iterator &pos, ConstIterator first, const ConstIterator &last)
 Inserts the range defined by [first;last) after pos.
 
Iterator Insert (const Iterator &pos)
 Inserts a default constructed element before the position defined by the iterator.
 
Iterator Remove (const Iterator &pos)
 Erases the element pointed to by the iterator.
 
Iterator Remove (Iterator first, const Iterator &last)
 Erases range [first; last).
 
Iterator GetIterator ()
 Returns an iterator to the first list-element.
 
Iterator GetEndIterator ()
 Returns an iterator pointing behind the last element. Necessary if one wants to insert elements at the end of a list.
 
ConstIterator GetIterator () const
 Returns a const-iterator to the first list-element.
 
ConstIterator GetEndIterator () const
 Returns a const-iterator pointing behind the last element. Necessary if one wants to insert elements at the end of a list.
 
plAllocatorGetAllocator () const
 Returns the allocator that is used by this instance.
 
bool operator== (const plListBase< T > &rhs) const
 Comparison operator.
 
 PL_ADD_DEFAULT_OPERATOR_NOTEQUAL (const plListBase< T > &)
 
plUInt64 GetHeapMemoryUsage () const
 Returns the amount of bytes that are currently allocated on the heap.
 

Protected Member Functions

 plListBase (plAllocator *pAllocator)
 Initializes the list to be empty.
 
 plListBase (const plListBase< T > &cc, plAllocator *pAllocator)
 Initializes the list with a copy from another list.
 
 ~plListBase ()
 Destroys the list and all its content.
 
void operator= (const plListBase< T > &cc)
 Copies the list cc into this list.
 

Detailed Description

template<typename T>
class plListBase< T >

A List-class, similar to STL::list.

This container class allows fast insertion and erasure of elements. Access is limited to iteration from front-to-back or back-to-front, there is no random-access. Define the type of object to store in the list via the template argument T.

Member Function Documentation

◆ SetCount()

template<typename T >
void plListBase< T >::SetCount ( plUInt32 uiNewSize)

Sets the number of elements that are in the list.

If uiNewSize is smaller than the size of the list, elements are popped from the back, until the desired size is reached. If uiNewSize is larger than the size of the list, default-constructed elements are appended to the list, until the desired size is reached.


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