Data Structures & Algorithms in C++
Goodrich, Tamassia, Mount and Goldwasser
|
doubly linked list, akin to std::list More...
#include <doubly_linked.h>
Data Structures | |
class | const_iterator |
class | iterator |
Public Member Functions | |
DoublyLinkedList () | |
Constructs an empty list. | |
int | size () const |
bool | empty () const |
T & | front () |
const T & | front () const |
T & | back () |
const T & | back () const |
void | push_front (const T &elem) |
void | push_back (const T &elem) |
void | pop_front () |
Removes the first element of the list. | |
void | pop_back () |
Removes the last element of the list. | |
iterator | begin () |
Returns iterator for the front of the list. | |
const_iterator | begin () const |
Returns const_iterator for the front of the list. | |
iterator | end () |
Returns iterator for the end of the list. | |
const_iterator | end () const |
Returns const_iterator for the end of the list. | |
iterator | insert (iterator it, const T &elem) |
iterator | erase (iterator it) |
void | clear () |
resets the list to empty | |
DoublyLinkedList (const DoublyLinkedList &other) | |
copy constructor | |
DoublyLinkedList & | operator= (const DoublyLinkedList &other) |
copy assignment | |
DoublyLinkedList (DoublyLinkedList &&other) | |
move constructor | |
DoublyLinkedList & | operator= (DoublyLinkedList &&other) |
move assignment | |
~DoublyLinkedList () | |
default destructor | |
Friends | |
void | swap (DoublyLinkedList &a, DoublyLinkedList &b) |
non-member function to swap two lists | |
doubly linked list, akin to std::list
|
inline |
Constructs an empty list.
|
inline |
copy constructor
|
inline |
move constructor
|
inline |
default destructor
|
inline |
Returns live reference to the last element of the list; behavior undefined if list is empty
|
inline |
Returns const reference to the last element of the list; behavior undefined if list is empty
|
inline |
Returns iterator for the front of the list.
|
inline |
Returns const_iterator for the front of the list.
|
inline |
resets the list to empty
|
inline |
Tests whether the list is empty.
|
inline |
Returns iterator for the end of the list.
|
inline |
Returns const_iterator for the end of the list.
|
inline |
Removes the element at the given position
it | iterator defining position |
|
inline |
Returns live reference to the first element of the list; behavior undefined if list is empty
|
inline |
Returns const reference to the first element of the list; behavior undefined if list is empty
|
inline |
Inserts new element immediately before the given position and returns iterator to new element
it | iterator defining position |
elem | element to insert |
|
inline |
copy assignment
|
inline |
move assignment
|
inline |
Removes the last element of the list.
|
inline |
Removes the first element of the list.
|
inline |
Inserts element at the end of the list
elem | the new element |
|
inline |
Inserts element at the beginning of the list
elem | the new element |
|
inline |
Returns the number of elements stored
|
friend |
non-member function to swap two lists