Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <dense_doubly_linked_list.h>
Public Member Functions | |
template<class T > | |
DenseDoublyLinkedList (const T &sorted_elements) | |
int | Size () const |
int | Next (int i) const |
Inline implementations (forced inline for the speed). | |
int | Prev (int i) const |
void | Remove (int i) |
You must not call Remove() twice with the same element. | |
Specialized doubly-linked list that initially holds [0..n-1] in an arbitrary (user-specified) and fixed order. It then supports O(1) removal and access to the next and previous element of a given (non-removed) element.
It is very fast and compact: it uses exactly 8*n bytes of memory.
Definition at line 29 of file dense_doubly_linked_list.h.
|
explicit |
You can construct a DenseDoublyLinkedList with any range-iterable class that also has a size() method. The order of the elements is given by the user and will never change (modulo the removal of elements).
Definition at line 77 of file dense_doubly_linked_list.h.
|
inline |
Inline implementations (forced inline for the speed).
Next() (resp. Prev()) must be called on elements that haven't yet been removed. They will return -1 if called on the last (resp. first) element.
Definition at line 54 of file dense_doubly_linked_list.h.
|
inline |
Definition at line 61 of file dense_doubly_linked_list.h.
|
inline |
You must not call Remove() twice with the same element.
Definition at line 68 of file dense_doubly_linked_list.h.
|
inline |
Definition at line 37 of file dense_doubly_linked_list.h.