|
ADS
Algorithms and Data Structures
|
a DEQUEUE on a bidirectional list with pointers More...
#include <ADS/queue/Dequeue.h>
Public types | |
| using | Item = T |
| the type of the items | |
| using | value_type = T |
| the type of the items | |
| using | size_type = std::size_t |
| the type of the sizes | |
| using | difference_type = std::ptrdiff_t |
| the type of the distances | |
| using | reference = T & |
| a reference to an item | |
| using | const_reference = const T & |
| a constant reference to an item | |
| using | iterator = typename List< T >::iterator |
| the iterator on the items | |
| using | const_iterator = typename List< T >::const_iterator |
| the iterator on the constant items | |
| using | reverse_iterator = typename List< T >::reverse_iterator |
| the iterator on the items, backwards | |
| using | const_reverse_iterator = typename List< T >::const_reverse_iterator |
| the iterator on the constant items, backwards | |
Public member functions | |
| bool | empty (void) const |
| true if there is no item | |
| void | insertHead (const T &v) |
| puts \( v \) at the head, insert( head() , v ) of the list | |
| void | insertTail (const T &v) |
| puts \( v \) at the tail, before the sentinel of the list | |
| T | removeHead (void) |
| removes the item at the head and returns it | |
| T | removeTail (void) |
| removes the item at the tail and returns it | |
| const T & | head (void) const |
| the item at the head | |
| const T & | tail (void) const |
| the item at the tail | |
| iterator | begin (void) |
| the iterator on the first item | |
| iterator | end (void) |
| the iterator past the last item | |
| const_iterator | begin (void) const |
| the constant iterator on the first item | |
| const_iterator | end (void) const |
| the constant iterator past the last item | |
| const_iterator | cbegin (void) const |
| the constant iterator on the first item | |
| const_iterator | cend (void) const |
| the constant iterator past the last item | |
| reverse_iterator | rbegin (void) |
| the iterator on the last item, backwards | |
| reverse_iterator | rend (void) |
| the iterator before the first item, backwards | |
| const_reverse_iterator | rbegin (void) const |
| the constant iterator on the last item, backwards | |
| const_reverse_iterator | rend (void) const |
| the constant iterator before the first item, backwards | |
| void | push_back (const T &v) |
| insertTail(), for std::back_inserter | |
| void | push_front (const T &v) |
| insertHead(), for std::front_inserter | |
a DEQUEUE on a bidirectional list with pointers
| using ADS::Dequeue< T >::const_iterator = typename List< T >::const_iterator |
the iterator on the constant items
| using ADS::Dequeue< T >::const_reference = const T & |
a constant reference to an item
| using ADS::Dequeue< T >::const_reverse_iterator = typename List< T >::const_reverse_iterator |
the iterator on the constant items, backwards
| using ADS::Dequeue< T >::difference_type = std::ptrdiff_t |
the type of the distances
| using ADS::Dequeue< T >::Item = T |
the type of the items
| using ADS::Dequeue< T >::iterator = typename List< T >::iterator |
the iterator on the items
| using ADS::Dequeue< T >::reference = T & |
a reference to an item
| using ADS::Dequeue< T >::reverse_iterator = typename List< T >::reverse_iterator |
the iterator on the items, backwards
| using ADS::Dequeue< T >::size_type = std::size_t |
the type of the sizes
| using ADS::Dequeue< T >::value_type = T |
the type of the items
|
inlinenodiscard |
the iterator on the first item
|
inlinenodiscard |
the constant iterator on the first item
|
inlinenodiscard |
the constant iterator on the first item
|
inlinenodiscard |
the constant iterator past the last item
|
nodiscard |
true if there is no item
|
inlinenodiscard |
the iterator past the last item
|
inlinenodiscard |
the constant iterator past the last item
|
nodiscard |
the item at the head
| void ADS::Dequeue< T >::insertHead | ( | const T & | v | ) |
puts \( v \) at the head, insert( head() , v ) of the list
In pseudocode (exercise 4.9), \( L \) the list:
\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{procedure}\ \mathrm{insertHead}( v ) \cr 2 & \quad L.\mathrm{insert}( L.\mathrm{head}() , v ) \end{array}} \]
| void ADS::Dequeue< T >::insertTail | ( | const T & | v | ) |
puts \( v \) at the tail, before the sentinel of the list
In pseudocode (exercise 4.9):
\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{procedure}\ \mathrm{insertTail}( v ) \cr 2 & \quad L.\mathrm{insert}( L.\mathrm{next}( L.\mathrm{tail}() ) , v ) \end{array}} \]
|
inline |
insertTail(), for std::back_inserter
|
inline |
insertHead(), for std::front_inserter
|
inlinenodiscard |
the iterator on the last item, backwards
|
inlinenodiscard |
the constant iterator on the last item, backwards
| T ADS::Dequeue< T >::removeHead | ( | void | ) |
removes the item at the head and returns it
In pseudocode (exercise 4.9):
\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{function}\ \mathrm{removeHead}() \cr 2 & \quad p \gets L.\mathrm{head}();\ v \gets L.\mathrm{read}( p ); \ L.\mathrm{remove}( p );\ \textbf{return}\ v \end{array}} \]
| T ADS::Dequeue< T >::removeTail | ( | void | ) |
removes the item at the tail and returns it
In pseudocode (exercise 4.9):
\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{function}\ \mathrm{removeTail}() \cr 2 & \quad p \gets L.\mathrm{tail}();\ v \gets L.\mathrm{read}( p ); \ L.\mathrm{remove}( p );\ \textbf{return}\ v \end{array}} \]
|
inlinenodiscard |
the iterator before the first item, backwards
|
inlinenodiscard |
the constant iterator before the first item, backwards
|
nodiscard |
the item at the tail