|
| List () |
| Constructs an empty doubly linked list.
|
|
| List (const List< E > &L) |
| Constructs a doubly linked list that is a copy of L .
|
|
| List (List< E > &&L) |
| Constructs a doubly linked list containing the elements of L (move semantics).
|
|
| List (std::initializer_list< E > init) |
| Constructs a doubly linked list containing the elements in init .
|
|
|
These methods provide simple access without changing the list.
|
int | size () const |
| Returns the number of elements in the list.
|
|
const ListPure< E > & | getListPure () const |
| Conversion to const ListPure.
|
|
|
The following operators are provided by lists.
|
List< E > & | operator= (const List< E > &L) |
| Assignment operator.
|
|
List< E > & | operator= (List< E > &&L) |
| Assignment operator (move semantics).
|
|
bool | operator== (const List< E > &L) const |
| Equality operator.
|
|
bool | operator!= (const List< E > &L) const |
| Inequality operator.
|
|
|
These method add elements to the list.
|
iterator | pushFront (const E &x) |
| Adds element x at the beginning of the list.
|
|
template<class... Args> |
iterator | emplaceFront (Args &&... args) |
| Adds a new element at the beginning of the list.
|
|
iterator | pushBack (const E &x) |
| Adds element x at the end of the list.
|
|
template<class... Args> |
iterator | emplaceBack (Args &&... args) |
| Adds a new element at the end of the list.
|
|
iterator | insert (const E &x, iterator it, Direction dir=Direction::after) |
| Inserts element x before or after it .
|
|
iterator | insertBefore (const E &x, iterator it) |
| Inserts element x before it .
|
|
iterator | insertAfter (const E &x, iterator it) |
| Inserts element x after it .
|
|
|
These method remove elements from the list.
|
void | popFront () |
| Removes the first element from the list.
|
|
E | popFrontRet () |
| Removes the first element from the list and returns it.
|
|
void | popBack () |
| Removes the last element from the list.
|
|
E | popBackRet () |
| Removes the last element from the list and returns it.
|
|
void | del (iterator it) |
| Removes it from the list.
|
|
bool | removeFirst (const E &x) |
| Removes the first occurrence of x (if any) from the list.
|
|
void | clear () |
| Removes all elements from the list.
|
|
|
The method allow to change the order of elements within the list, or to move elements to another list.
|
void | moveToFront (iterator it, List< E > &L2) |
| Moves it to the begin of the list.
|
|
void | moveToBack (iterator it, List< E > &L2) |
| Moves it to the end of the list.
|
|
void | moveToSucc (iterator it, List< E > &L2, iterator itBefore) |
| Moves it after itBefore .
|
|
void | moveToPrec (iterator it, List< E > &L2, iterator itAfter) |
| Moves it before itAfter .
|
|
void | conc (List< E > &L2) |
| Appends L2 to this list and makes L2 empty.
|
|
void | concFront (List< E > &L2) |
| Prepends L2 to this list and makes L2 empty.
|
|
void | swap (List< E > &other) |
| Exchanges the contents of this list and other in constant time.
|
|
void | split (iterator it, List< E > &L1, List< E > &L2, Direction dir=Direction::before) |
| Splits the list at element it into lists L1 and L2 .
|
|
|
using | const_iterator = ListConstIterator< E > |
| Provides a bidirectional iterator that can read a const element in a list.
|
|
using | const_reference = const E & |
| Provides a reference to a const element stored in a list for reading and performing const operations.
|
|
using | const_reverse_iterator = ListConstReverseIterator< E > |
| Provides a bidirectional reverse iterator that can read a const element in a list.
|
|
using | iterator = ListIterator< E > |
| Provides a bidirectional iterator that can read or modify any element in a list.
|
|
using | reference = E & |
| Provides a reference to an element stored in a list.
|
|
using | reverse_iterator = ListReverseIterator< E > |
| Provides a bidirectional reverse iterator that can read or modify any element in a list.
|
|
using | value_type = E |
| Represents the data type stored in a list element.
|
|
| ListPure () |
| Constructs an empty doubly linked list.
|
|
| ListPure (const ListPure< E > &L) |
| Constructs a doubly linked list that is a copy of L .
|
|
| ListPure (ListPure< E > &&L) |
| Constructs a doubly linked list containing the elements of L (move semantics).
|
|
| ListPure (std::initializer_list< E > init) |
| Constructs a doubly linked list containing the elements in init .
|
|
virtual | ~ListPure () |
| Destructor.
|
|
bool | empty () const |
| Returns true iff the list is empty.
|
|
const_reference | front () const |
| Returns a const reference to the first element.
|
|
reference | front () |
| Returns a reference to the first element.
|
|
const_reference | back () const |
| Returns a const reference to the last element.
|
|
reference | back () |
| Returns a reference to the last element.
|
|
const_iterator | get (int pos) const |
| Returns a const iterator pointing to the element at position pos .
|
|
iterator | get (int pos) |
| Returns an iterator pointing to the element at position pos .
|
|
int | pos (const_iterator it) const |
| Returns the position (starting with 0) of iterator it in the list.
|
|
iterator | begin () |
| Returns an iterator to the first element of the list.
|
|
const_iterator | begin () const |
| Returns a const iterator to the first element of the list.
|
|
const_iterator | cbegin () const |
| Returns a const iterator to the first element of the list.
|
|
iterator | end () |
| Returns an iterator to one-past-last element of the list.
|
|
const_iterator | end () const |
| Returns a const iterator to one-past-last element of the list.
|
|
const_iterator | cend () const |
| Returns a const iterator to one-past-last element of the list.
|
|
reverse_iterator | rbegin () |
| Returns an iterator to the last element of the list.
|
|
const_reverse_iterator | rbegin () const |
| Returns a const iterator to the last element of the list.
|
|
const_reverse_iterator | crbegin () const |
| Returns a const iterator to the last element of the list.
|
|
reverse_iterator | rend () |
| Returns an iterator to one-before-first element of the list.
|
|
const_reverse_iterator | rend () const |
| Returns a const iterator to one-before-first element of the list.
|
|
const_reverse_iterator | crend () const |
| Returns a const iterator to one-before-first element of the list.
|
|
const_iterator | cyclicSucc (const_iterator it) const |
| Returns a const iterator to the cyclic successor of it .
|
|
iterator | cyclicSucc (iterator it) |
| Returns an iterator to the cyclic successor of it .
|
|
const_reverse_iterator | cyclicSucc (const_reverse_iterator it) const |
| Returns a const iterator to the cyclic successor of it .
|
|
reverse_iterator | cyclicSucc (reverse_iterator it) |
| Returns a const iterator to the cyclic successor of it .
|
|
const_iterator | cyclicPred (const_iterator it) const |
| Returns a const iterator to the cyclic predecessor of it .
|
|
iterator | cyclicPred (iterator it) |
| Returns an iterator to the cyclic predecessor of it .
|
|
const_reverse_iterator | cyclicPred (const_reverse_iterator it) const |
| Returns a const iterator to the cyclic predecessor of it .
|
|
reverse_iterator | cyclicPred (reverse_iterator it) |
| Returns a const iterator to the cyclic predecessor of it .
|
|
ListPure< E > & | operator= (const ListPure< E > &L) |
| Assignment operator.
|
|
ListPure< E > & | operator= (ListPure< E > &&L) |
| Assignment operator (move semantics).
|
|
bool | operator== (const ListPure< E > &L) const |
| Equality operator.
|
|
bool | operator!= (const ListPure< E > &L) const |
| Inequality operator.
|
|
iterator | pushFront (const E &x) |
| Adds element x at the beginning of the list.
|
|
template<class... Args> |
iterator | emplaceFront (Args &&... args) |
| Adds a new element at the beginning of the list.
|
|
iterator | pushBack (const E &x) |
| Adds element x at the end of the list.
|
|
template<class... Args> |
iterator | emplaceBack (Args &&... args) |
| Adds a new element at the end of the list.
|
|
iterator | insert (const E &x, iterator it, Direction dir=Direction::after) |
| Inserts element x before or after it .
|
|
iterator | insertBefore (const E &x, iterator it) |
| Inserts element x before it .
|
|
iterator | insertAfter (const E &x, iterator it) |
| Inserts element x after it .
|
|
void | popFront () |
| Removes the first element from the list.
|
|
E | popFrontRet () |
| Removes the first element from the list and returns it.
|
|
void | popBack () |
| Removes the last element from the list.
|
|
E | popBackRet () |
| Removes the last element from the list and returns it.
|
|
void | del (iterator it) |
| Removes it from the list.
|
|
bool | removeFirst (const E &x) |
| Removes the first occurrence of x (if any) from the list.
|
|
void | clear () |
| Removes all elements from the list.
|
|
void | exchange (iterator it1, iterator it2) |
| Exchanges the positions of it1 and it2 in the list.
|
|
void | moveToFront (iterator it) |
| Moves it to the begin of the list.
|
|
void | moveToBack (iterator it) |
| Moves it to the end of the list.
|
|
void | moveToSucc (iterator it, iterator itBefore) |
| Moves it after itBefore .
|
|
void | moveToPrec (iterator it, iterator itAfter) |
| Moves it before itAfter .
|
|
void | moveToFront (iterator it, ListPure< E > &L2) |
| Moves it to the begin of L2 .
|
|
void | moveToBack (iterator it, ListPure< E > &L2) |
| Moves it to the end of L2 .
|
|
void | moveToSucc (iterator it, ListPure< E > &L2, iterator itBefore) |
| Moves it to list L2 and inserts it after itBefore .
|
|
void | moveToPrec (iterator it, ListPure< E > &L2, iterator itAfter) |
| Moves it to list L2 and inserts it before itAfter .
|
|
void | conc (ListPure< E > &L2) |
| Appends L2 to this list and makes L2 empty.
|
|
void | concFront (ListPure< E > &L2) |
| Prepends L2 to this list and makes L2 empty.
|
|
void | swap (ListPure< E > &other) |
| Exchanges the contents of this list and other in constant time.
|
|
void | split (iterator it, ListPure< E > &L1, ListPure< E > &L2, Direction dir=Direction::before) |
| Splits the list at element it into lists L1 and L2 .
|
|
void | splitAfter (iterator it, ListPure< E > &L2) |
| Splits the list after it .
|
|
void | splitBefore (iterator it, ListPure< E > &L2) |
| Splits the list before it .
|
|
void | reverse () |
| Reverses the order of the list elements.
|
|
ListConstIterator< E > | search (const E &e) const |
| Scans the list for the specified element and returns an iterator to the first occurrence in the list, or an invalid iterator if not found.
|
|
ListIterator< E > | search (const E &e) |
| Scans the list for the specified element and returns an iterator to the first occurrence in the list, or an invalid iterator if not found.
|
|
template<class COMPARER > |
ListConstIterator< E > | search (const E &e, const COMPARER &comp) const |
| Scans the list for the specified element (using the user-defined comparer) and returns an iterator to the first occurrence in the list, or an invalid iterator if not found.
|
|
template<class COMPARER > |
ListIterator< E > | search (const E &e, const COMPARER &comp) |
| Scans the list for the specified element (using the user-defined comparer) and returns an iterator to the first occurrence in the list, or an invalid iterator if not found.
|
|
void | quicksort () |
| Sorts the list using Quicksort.
|
|
template<class COMPARER > |
void | quicksort (const COMPARER &comp) |
| Sorts the list using Quicksort and comparer comp .
|
|
void | bucketSort (int l, int h, BucketFunc< E > &f) |
| Sorts the list using bucket sort.
|
|
const_iterator | chooseIterator (std::function< bool(const E &)> includeElement=[](const E &) { return true;}, bool isFastTest=true) const |
| Returns an iterator to a random element.
|
|
iterator | chooseIterator (std::function< bool(const E &)> includeElement=[](const E &) { return true;}, bool isFastTest=true) |
| Returns an iterator to a random element.
|
|
const_reference | chooseElement (std::function< bool(const E &)> includeElement=[](const E &) { return true;}, bool isFastTest=true) const |
| Returns a random element.
|
|
reference | chooseElement (std::function< bool(const E &)> includeElement=[](const E &) { return true;}, bool isFastTest=true) |
| Returns a random element.
|
|
void | permute () |
| Randomly permutes the elements in the list.
|
|
template<class RNG > |
void | permute (RNG &rng) |
| Randomly permutes the elements in the list using random number generator rng .
|
|
void | copy (const ListPure< E > &L) |
|
template<class RNG > |
void | permute (const int n, RNG &rng) |
| permutes elements in list randomly; n is the length of the list
|
|
void | reassignListRefs (ListElement< E > *start=nullptr) |
| Sets the debug reference of all list elements starting at start to this .
|
|
template<
class E>
class ogdf::List< E >
Doubly linked lists (maintaining the length of the list).
Use ogdf::ListConstIterator or ogdf::ListIterator in order to iterate over the list.
In contrast to ogdf::ListPure, instances of ogdf::List store the length of the list.
- Template Parameters
-
E | is the data type stored in list elements. |
Definition at line 1435 of file List.h.