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

doubly-linked list More...

#include <modm/container/doubly_linked_list.hpp>

Classes

struct  Node
 
class  const_iterator
 Forward const iterator More...
 
class  iterator
 Forward iterator More...
 

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. More...
 
bool prepend (const T &value)
 Insert in front.
 
void append (const T &value)
 Insert at the end of the list.
 
void removeFront ()
 Remove the first entry.
 
void removeBack ()
 
const T & getFront () const
 
const T & getBack () const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
iterator erase (iterator position)
 

Protected Typedefs

typedef Allocator::template rebind< Node >::other NodeAllocator
 

Protected Attributes

NodeAllocator nodeAllocator
 
Nodefront
 
Nodeback
 

Friends

class const_iterator
 
class iterator
 

Detailed Description

template<typename T, typename Allocator = allocator::Dynamic<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 = allocator::Dynamic<T>>
iterator modm::DoublyLinkedList< T, Allocator >::begin ( )

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 = allocator::Dynamic<T>>
const_iterator modm::DoublyLinkedList< T, Allocator >::begin ( ) const

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 = allocator::Dynamic<T>>
iterator modm::DoublyLinkedList< T, Allocator >::end ( )

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 = allocator::Dynamic<T>>
const_iterator modm::DoublyLinkedList< T, Allocator >::end ( ) const

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 = allocator::Dynamic<T>>
iterator modm::DoublyLinkedList< T, Allocator >::erase ( iterator  position)

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 = allocator::Dynamic<T>>
const T& modm::DoublyLinkedList< T, Allocator >::getBack ( ) const
inline
Returns
the last node in the list
template<typename T , typename Allocator = allocator::Dynamic<T>>
const T& modm::DoublyLinkedList< T, Allocator >::getFront ( ) const
inline
Returns
the first node in the list
template<typename T , typename Allocator = allocator::Dynamic<T>>
std::size_t modm::DoublyLinkedList< T, Allocator >::getSize ( ) const

Get number of items in the list.

Very slow for a long list as it needs to iterate through all items in the list.


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