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

Singly-linked list. More...

#include <modm/container/linked_list.hpp>

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

Public Typedefs

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

Public Member Functions

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

Detailed Description

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

Singly-linked list.

Template Parameters
TType of list entries
AllocatorAllocator used for memory allocation. See classes from modm::allocator namespace.
Author
Fabian Greif

Member Function Documentation

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

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
inheritedinline

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 ( )
inheritedinline

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
inheritedinline

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)
inheritedinline

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

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: