Simple Application Framework
1
|
Doubly-linked list container. More...
#include <List.h>
Classes | |
class | ConstIterator |
Bidirectional non-mutable List iterator. More... | |
class | Iterator |
Bidirectional mutable List iterator. More... | |
class | Node |
List node. More... | |
Public Member Functions | |
List () | |
Constructor. | |
List (const MyType &list) | |
Copy constructor. | |
~List () | |
Destructor. | |
Iterator | Back () |
Iterator to the last element. | |
ConstIterator | Back () const |
Iterator to the last element. | |
Iterator | Begin () |
Iterator to the first element. | |
ConstIterator | Begin () const |
Iterator to the first element. | |
Iterator | End () |
Iterator one behind the last element. | |
ConstIterator | End () const |
Iterator one behind the last element. | |
Iterator | Erase (Iterator iter) |
Remove element from the list. | |
void | Free () |
Free memory occupied by the list. | |
Iterator | Front () |
Iterator to the first element. | |
ConstIterator | Front () const |
Iterator to the first element. | |
Iterator | InsertAfter (Iterator iter, const T &val) |
Insert element after a given element. | |
Iterator | InsertBefore (Iterator iter, const T &val) |
Insert element before a given element. | |
bool | IsEmpty () const |
Check whether the list is empty. | |
template<class Comp > | |
MyType & | Merge (MyType &list, Comp comp) |
Merge in elements from a given list. | |
MyType & | operator= (const MyType &l) |
Assignment operator. | |
MyType & | PopBack () |
Remove the last element. | |
MyType & | PopFront () |
Remove the first element. | |
MyType & | PushBack (const T &val) |
Insert element on the tail of the list. | |
MyType & | PushFront (const T &val) |
Insert element on the beginning of the list. | |
template<class Pred > | |
Size | RemoveIf (Pred pred) |
Erase all elements satisfying a given predicate. | |
MyType & | Reverse () |
In-place list reverse. | |
template<class Comp > | |
MyType & | Sort (Comp comp) |
Sort list. | |
MyType & | SpliceBefore (Iterator el, MyType &list) |
Splice lists. | |
MyType & | SpliceBefore (Iterator el, Iterator first) |
Splice lists. | |
MyType & | SpliceBefore (Iterator el, Iterator first, Iterator last) |
Splice lists. | |
MyType & | Swap (MyType &l) |
Swap the content of two lists. | |
template<class Pred > | |
Size | Unique (Pred pred) |
Erase all elements that satisfy the given predicate with their predecessor. | |
Protected Types | |
typedef List< T > | MyType |
Doubly-linked list container.
This class implements a data container where each element is stored in its own storage location and the individual locations are interconnected into a doubly-linked list.
The container allows following operations in constant time:
The following operations can be performed in linear time:
Finally, it is possible to efficiently sort the elements in the list using the Sort() method.
Iterator category: Bidirectional.
T | Data type. |
typedef List<T> Saf::Collection::List< T >::MyType [protected] |
Saf::Collection::List< T >::List | ( | ) | [inline] |
Constructor.
Saf::Collection::List< T >::List | ( | const MyType & | list | ) | [inline] |
Copy constructor.
Saf::Collection::List< T >::~List | ( | ) | [inline] |
Destructor.
Iterator Saf::Collection::List< T >::Back | ( | ) | [inline] |
Iterator to the last element.
ConstIterator Saf::Collection::List< T >::Back | ( | ) | const [inline] |
Iterator to the last element.
Iterator Saf::Collection::List< T >::Begin | ( | ) | [inline] |
Iterator to the first element.
ConstIterator Saf::Collection::List< T >::Begin | ( | ) | const [inline] |
Iterator to the first element.
Iterator Saf::Collection::List< T >::End | ( | ) | [inline] |
Iterator one behind the last element.
ConstIterator Saf::Collection::List< T >::End | ( | ) | const [inline] |
Iterator one behind the last element.
Iterator Saf::Collection::List< T >::Erase | ( | Iterator | iter | ) | [inline] |
Remove element from the list.
Properties:
void Saf::Collection::List< T >::Free | ( | ) | [inline] |
Free memory occupied by the list.
Iterator Saf::Collection::List< T >::Front | ( | ) | [inline] |
Iterator to the first element.
ConstIterator Saf::Collection::List< T >::Front | ( | ) | const [inline] |
Iterator to the first element.
Iterator Saf::Collection::List< T >::InsertAfter | ( | Iterator | iter, |
const T & | val | ||
) | [inline] |
Insert element after a given element.
Properties:
Iterator Saf::Collection::List< T >::InsertBefore | ( | Iterator | iter, |
const T & | val | ||
) | [inline] |
Insert element before a given element.
Properties:
bool Saf::Collection::List< T >::IsEmpty | ( | ) | const [inline] |
Check whether the list is empty.
Properties:
MyType& Saf::Collection::List< T >::Merge | ( | MyType & | list, |
Comp | comp | ||
) | [inline] |
Merge in elements from a given list.
Both lists are assumed to be sorted according to the predicate Comp
.
Properties:
[in] | list | List to be merged in. |
[in] | comp | Comparison predicate. |
MyType& Saf::Collection::List< T >::operator= | ( | const MyType & | l | ) | [inline] |
Assignment operator.
MyType& Saf::Collection::List< T >::PopBack | ( | ) | [inline] |
Remove the last element.
Properties:
MyType& Saf::Collection::List< T >::PopFront | ( | ) | [inline] |
Remove the first element.
Properties:
MyType& Saf::Collection::List< T >::PushBack | ( | const T & | val | ) | [inline] |
Insert element on the tail of the list.
Properties:
MyType& Saf::Collection::List< T >::PushFront | ( | const T & | val | ) | [inline] |
Insert element on the beginning of the list.
Properties:
Size Saf::Collection::List< T >::RemoveIf | ( | Pred | pred | ) | [inline] |
Erase all elements satisfying a given predicate.
Properties:
MyType& Saf::Collection::List< T >::Reverse | ( | ) | [inline] |
In-place list reverse.
Properties:
MyType& Saf::Collection::List< T >::Sort | ( | Comp | comp | ) | [inline] |
Sort list.
A merge sort variant is used to sort the list.
Properties:
[in] | comp | Comparison predicate. |
MyType& Saf::Collection::List< T >::SpliceBefore | ( | Iterator | el, |
MyType & | list | ||
) | [inline] |
Splice lists.
All elements from list
are spliced into this list before element el
.
Properties:
MyType& Saf::Collection::List< T >::SpliceBefore | ( | Iterator | el, |
Iterator | first | ||
) | [inline] |
Splice lists.
Move element first
from its original list to this list before element el
.
Properties:
MyType& Saf::Collection::List< T >::SpliceBefore | ( | Iterator | el, |
Iterator | first, | ||
Iterator | last | ||
) | [inline] |
Splice lists.
Move the range [first, last)
from its original list to this list before element el
.
Properties:
MyType& Saf::Collection::List< T >::Swap | ( | MyType & | l | ) | [inline] |
Swap the content of two lists.
Properties:
Size Saf::Collection::List< T >::Unique | ( | Pred | pred | ) | [inline] |
Erase all elements that satisfy the given predicate with their predecessor.
Properties: