modm API documentation
modm::DoublyLinkedList< T, Allocator > Class Template Reference

doubly-linked list More...

#include <modm/container/doubly_linked_list.hpp>

Inheritance diagram for modm::DoublyLinkedList< T, Allocator >:
modm::LinkedList< T, Allocator >

Public Typedefs

using const_iterator = std::list< T >::const_iterator
 
using iterator = std::list< T >::iterator
 
using Size = std::size_t
 

Public Member Functions

 DoublyLinkedList (const Allocator &allocator=Allocator ())
 
bool isEmpty () const
 check if there are any nodes in the list
 
std::size_t getSize () const
 Get number of items in the list.
 
bool prepend (const T &value)
 Insert in front.
 
bool append (const T &value)
 Insert at the end of the list.
 
void removeFront ()
 Remove the first entry.
 
void removeBack ()
 
T & getFront ()
 
const T & getFront () const
 
T & getBack ()
 
const T & getBack () const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
iterator erase (iterator position)
 
bool insert (iterator position, const T &value)
 

Detailed Description

template<typename T, typename Allocator = std::allocator<T>>
class modm::DoublyLinkedList< T, Allocator >

doubly-linked list

Template Parameters
Ttype of list entries
Author
Fabian Greif

Member Function Documentation

template<typename T , typename Allocator = std::allocator<T>>
iterator modm::DoublyLinkedList< T, Allocator >::begin ( )
inline

Returns a read/write iterator that points to the first element in the list. Iteration is done in ordinary element order.

template<typename T , typename Allocator = std::allocator<T>>
const_iterator modm::DoublyLinkedList< T, Allocator >::begin ( ) const
inline

Returns a read-only (constant) iterator that points to the first element in the list. Iteration is done in ordinary element order.

template<typename T , typename Allocator = std::allocator<T>>
iterator modm::DoublyLinkedList< T, Allocator >::end ( )
inline

Returns a read/write iterator that points one past the last element in the list. Iteration is done in ordinary element order.

template<typename T , typename Allocator = std::allocator<T>>
const_iterator modm::DoublyLinkedList< T, Allocator >::end ( ) const
inline

Returns a read-only (constant) iterator that points one past the last element in the list. Iteration is done in ordinary element order.

template<typename T , typename Allocator = std::allocator<T>>
iterator modm::DoublyLinkedList< T, Allocator >::erase ( iterator  position)
inline

Deletes element pointed to by iterator and returns an iterator to the next element behind the deleted one.

Warning: you must not use the iterator after calling erase()

template<typename T , typename Allocator = std::allocator<T>>
const T& modm::DoublyLinkedList< T, Allocator >::getBack ( ) const
inline
Returns
the last node in the list
template<typename T , typename Allocator = std::allocator<T>>
const T& modm::DoublyLinkedList< T, Allocator >::getFront ( ) const
inline
Returns
the first node in the list
template<typename T , typename Allocator = std::allocator<T>>
bool modm::DoublyLinkedList< T, Allocator >::insert ( iterator  position,
const T &  value 
)
inline

Insert data after position iterator.

This behavior is compatible with modm::LinkedList but different compared to std::list which inserts before the position iterator argument.


The documentation for this class was generated from the following file: