Stefan Scholz / ETL
Embed: (wiki syntax)

« Back to documentation index

forward_list< T, MAX_SIZE_ > Class Template Reference

A templated forward_list implementation that uses a fixed size pool. More...

#include <forward_list.h>

Inherits etl::iforward_list< T >.

Public Types

typedef size_t size_type
 The type used for determining the size of forward_list.

Public Member Functions

 forward_list ()
 Default constructor.
 forward_list (size_t initial_size, typename etl::iforward_list< T >::parameter_t value=T())
 Construct from size and value.
 forward_list (const forward_list &other)
 Copy constructor.
template<typename TIterator >
 forward_list (TIterator first, TIterator last)
 Construct from range.
 ~forward_list ()
 Destructor.
forward_listoperator= (const forward_list &rhs)
 Assignment operator.
iterator begin ()
 Gets the beginning of the forward_list.
const_iterator begin () const
 Gets the beginning of the forward_list.
iterator before_begin ()
 Gets before the beginning of the forward_list.
const_iterator before_begin () const
 Gets before the beginning of the forward_list.
const_iterator cbegin () const
 Gets the beginning of the forward_list.
iterator end ()
 Gets the end of the forward_list.
const_iterator end () const
 Gets the end of the forward_list.
const_iterator cend () const
 Gets the end of the forward_list.
void clear ()
 Clears the forward_list.
reference front ()
 Gets a reference to the first element.
const_reference front () const
 Gets a const reference to the first element.
template<typename TIterator >
void assign (TIterator first, TIterator last)
 Assigns a range of values to the forward_list.
void assign (size_t n, parameter_t value)
 Assigns 'n' copies of a value to the forward_list.
void push_front ()
 Adds a node to the front of the forward_list so a new value can be assigned to front().
void push_front (parameter_t value)
 Pushes a value to the front of the forward_list.
template<typename T1 >
void emplace_front (const T1 &value1)
 Emplaces a value to the front of the list..
template<typename T1 , typename T2 >
void emplace_front (const T1 &value1, const T2 &value2)
 Emplaces a value to the front of the list..
template<typename T1 , typename T2 , typename T3 >
void emplace_front (const T1 &value1, const T2 &value2, const T3 &value3)
 Emplaces a value to the front of the list..
template<typename T1 , typename T2 , typename T3 , typename T4 >
void emplace_front (const T1 &value1, const T2 &value2, const T3 &value3, const T4 &value4)
 Emplaces a value to the front of the list..
void pop_front ()
 Removes a value from the front of the forward_list.
void resize (size_t n)
 Resizes the forward_list.
void resize (size_t n, T value)
 Resizes the forward_list.
iterator insert_after (iterator position, parameter_t value)
 Inserts a value to the forward_list after the specified position.
void insert_after (iterator position, size_t n, parameter_t value)
 Inserts 'n' copies of a value to the forward_list after the specified position.
template<typename TIterator >
void insert_after (iterator position, TIterator first, TIterator last)
 Inserts a range of values to the forward_list after the specified position.
template<typename T1 >
iterator emplace_after (iterator position, const T1 &value1)
 Emplaces a value to the forward_list after the specified position.
template<typename T1 , typename T2 >
iterator emplace_after (iterator position, const T1 &value1, const T2 &value2)
 Emplaces a value to the forward_list after the specified position.
template<typename T1 , typename T2 , typename T3 >
iterator emplace_after (iterator position, const T1 &value1, const T2 &value2, const T3 &value3)
 Emplaces a value to the forward_list after the specified position.
template<typename T1 , typename T2 , typename T3 , typename T4 >
iterator emplace_after (iterator position, const T1 &value1, const T2 &value2, const T3 &value3, const T4 &value4)
 Emplaces a value to the forward_list after the specified position.
iterator erase_after (iterator position)
 Erases the value at the specified position.
iterator erase_after (iterator first, iterator last)
 Erases a range of elements.
void move_after (const_iterator from_before, const_iterator to_before)
 Erases the value at the specified position.
void move_after (const_iterator first_before, const_iterator last, const_iterator to_before)
 Moves a range from one position to another within the list.
void unique ()
 Removes all but the first element from every consecutive group of equal elements in the container.
template<typename TIsEqual >
void unique (TIsEqual isEqual)
 Removes all but the one element from every consecutive group of equal elements in the container.
void sort ()
 Sort using in-place merge sort algorithm.
template<typename TCompare >
void sort (TCompare compare)
 Sort using in-place merge sort algorithm.
template<typename TPredicate >
void remove_if (TPredicate predicate)
 Removes according to a predicate.
size_type size () const
 Gets the size of the forward_list.
size_type max_size () const
 Gets the maximum possible size of the forward_list.
bool empty () const
 Checks to see if the forward_list is empty.
bool full () const
 Checks to see if the forward_list is full.
size_t available () const
 Returns the remaining capacity.
void reverse ()
 Reverses the forward_list.

Static Public Attributes

static const size_t MAX_SIZE = MAX_SIZE_
 The maximum size of the forward_list.

Protected Member Functions

void initialise ()
 Initialise the forward_list.
node_tget_head ()
 Get the head node.
const node_tget_head () const
 Get the head node.
void insert_node_after (node_t &position, node_t &node)
 Insert a node.
bool is_trivial_list () const
 Is the forward_list a trivial length?
void join (node_t *left, node_t *right)
 Join two nodes.

Protected Attributes

node_t start_node
 The node that acts as the forward_list start.
etl::ipool * p_node_pool
 The pool of data nodes used in the list.
etl::debug_count construct_count
 Internal debugging.

Detailed Description

template<typename T, const size_t MAX_SIZE_>
class etl::forward_list< T, MAX_SIZE_ >

A templated forward_list implementation that uses a fixed size pool.

Note:
'merge' and 'splice_after' and are not supported.

Definition at line 1327 of file forward_list.h.


Member Typedef Documentation

typedef size_t size_type

The type used for determining the size of forward_list.

Reimplemented from iforward_list< T >.

Definition at line 1340 of file forward_list.h.


Constructor & Destructor Documentation

forward_list (  )

Default constructor.

Definition at line 1345 of file forward_list.h.

forward_list ( size_t  initial_size,
typename etl::iforward_list< T >::parameter_t  value = T() 
) [explicit]

Construct from size and value.

Definition at line 1354 of file forward_list.h.

forward_list ( const forward_list< T, MAX_SIZE_ > &  other )

Copy constructor.

Definition at line 1363 of file forward_list.h.

forward_list ( TIterator  first,
TIterator  last 
)

Construct from range.

Definition at line 1373 of file forward_list.h.

~forward_list (  )

Destructor.

Definition at line 1382 of file forward_list.h.


Member Function Documentation

void assign ( TIterator  first,
TIterator  last 
) [inherited]

Assigns a range of values to the forward_list.

If asserts or exceptions are enabled throws etl::forward_list_full if the forward_list does not have enough free space. If ETL_THROW_EXCEPTIONS & ETL_DEBUG are defined throws forward_list_iterator if the iterators are reversed.

Definition at line 574 of file forward_list.h.

void assign ( size_t  n,
parameter_t  value 
) [inherited]

Assigns 'n' copies of a value to the forward_list.

Definition at line 600 of file forward_list.h.

size_t available (  ) const [inherited]

Returns the remaining capacity.

Returns:
The remaining capacity.

Definition at line 181 of file forward_list.h.

const_iterator before_begin (  ) const [inherited]

Gets before the beginning of the forward_list.

Definition at line 507 of file forward_list.h.

iterator before_begin (  ) [inherited]

Gets before the beginning of the forward_list.

Definition at line 499 of file forward_list.h.

iterator begin (  ) [inherited]

Gets the beginning of the forward_list.

Definition at line 483 of file forward_list.h.

const_iterator begin (  ) const [inherited]

Gets the beginning of the forward_list.

Definition at line 491 of file forward_list.h.

const_iterator cbegin (  ) const [inherited]

Gets the beginning of the forward_list.

Definition at line 515 of file forward_list.h.

const_iterator cend (  ) const [inherited]

Gets the end of the forward_list.

Definition at line 539 of file forward_list.h.

void clear (  ) [inherited]

Clears the forward_list.

Definition at line 547 of file forward_list.h.

iterator emplace_after ( iterator  position,
const T1 &  value1 
) [inherited]

Emplaces a value to the forward_list after the specified position.

Definition at line 772 of file forward_list.h.

iterator emplace_after ( iterator  position,
const T1 &  value1,
const T2 &  value2 
) [inherited]

Emplaces a value to the forward_list after the specified position.

Definition at line 788 of file forward_list.h.

iterator emplace_after ( iterator  position,
const T1 &  value1,
const T2 &  value2,
const T3 &  value3 
) [inherited]

Emplaces a value to the forward_list after the specified position.

Definition at line 804 of file forward_list.h.

iterator emplace_after ( iterator  position,
const T1 &  value1,
const T2 &  value2,
const T3 &  value3,
const T4 &  value4 
) [inherited]

Emplaces a value to the forward_list after the specified position.

Definition at line 820 of file forward_list.h.

void emplace_front ( const T1 &  value1 ) [inherited]

Emplaces a value to the front of the list..

Definition at line 643 of file forward_list.h.

void emplace_front ( const T1 &  value1,
const T2 &  value2 
) [inherited]

Emplaces a value to the front of the list..

Definition at line 658 of file forward_list.h.

void emplace_front ( const T1 &  value1,
const T2 &  value2,
const T3 &  value3 
) [inherited]

Emplaces a value to the front of the list..

Definition at line 673 of file forward_list.h.

void emplace_front ( const T1 &  value1,
const T2 &  value2,
const T3 &  value3,
const T4 &  value4 
) [inherited]

Emplaces a value to the front of the list..

Definition at line 688 of file forward_list.h.

bool empty (  ) const [inherited]

Checks to see if the forward_list is empty.

Definition at line 164 of file forward_list.h.

const_iterator end (  ) const [inherited]

Gets the end of the forward_list.

Definition at line 531 of file forward_list.h.

iterator end (  ) [inherited]

Gets the end of the forward_list.

Definition at line 523 of file forward_list.h.

iterator erase_after ( iterator  first,
iterator  last 
) [inherited]

Erases a range of elements.

Definition at line 889 of file forward_list.h.

iterator erase_after ( iterator  position ) [inherited]

Erases the value at the specified position.

Definition at line 870 of file forward_list.h.

reference front (  ) [inherited]

Gets a reference to the first element.

Definition at line 555 of file forward_list.h.

const_reference front (  ) const [inherited]

Gets a const reference to the first element.

Definition at line 563 of file forward_list.h.

bool full (  ) const [inherited]

Checks to see if the forward_list is full.

Definition at line 172 of file forward_list.h.

node_t& get_head (  ) [protected, inherited]

Get the head node.

Definition at line 228 of file forward_list.h.

const node_t& get_head (  ) const [protected, inherited]

Get the head node.

Definition at line 236 of file forward_list.h.

void initialise (  ) [protected, inherited]

Initialise the forward_list.

Definition at line 1225 of file forward_list.h.

iterator insert_after ( iterator  position,
parameter_t  value 
) [inherited]

Inserts a value to the forward_list after the specified position.

Definition at line 758 of file forward_list.h.

void insert_after ( iterator  position,
size_t  n,
parameter_t  value 
) [inherited]

Inserts 'n' copies of a value to the forward_list after the specified position.

Definition at line 835 of file forward_list.h.

void insert_after ( iterator  position,
TIterator  first,
TIterator  last 
) [inherited]

Inserts a range of values to the forward_list after the specified position.

Definition at line 851 of file forward_list.h.

void insert_node_after ( node_t position,
node_t node 
) [protected, inherited]

Insert a node.

Definition at line 244 of file forward_list.h.

bool is_trivial_list (  ) const [protected, inherited]

Is the forward_list a trivial length?

Definition at line 254 of file forward_list.h.

void join ( node_t left,
node_t right 
) [protected, inherited]

Join two nodes.

Definition at line 262 of file forward_list.h.

size_type max_size (  ) const [inherited]

Gets the maximum possible size of the forward_list.

Definition at line 156 of file forward_list.h.

void move_after ( const_iterator  from_before,
const_iterator  to_before 
) [inherited]

Erases the value at the specified position.

Definition at line 928 of file forward_list.h.

void move_after ( const_iterator  first_before,
const_iterator  last,
const_iterator  to_before 
) [inherited]

Moves a range from one position to another within the list.

Moves a range at position 'first_before'/'last' to the position before 'to_before'.

Definition at line 952 of file forward_list.h.

forward_list& operator= ( const forward_list< T, MAX_SIZE_ > &  rhs )

Assignment operator.

Definition at line 1390 of file forward_list.h.

void pop_front (  ) [inherited]

Removes a value from the front of the forward_list.

Definition at line 702 of file forward_list.h.

void push_front ( parameter_t  value ) [inherited]

Pushes a value to the front of the forward_list.

Definition at line 629 of file forward_list.h.

void push_front (  ) [inherited]

Adds a node to the front of the forward_list so a new value can be assigned to front().

Definition at line 621 of file forward_list.h.

void remove_if ( TPredicate  predicate ) [inherited]

Removes according to a predicate.

Definition at line 1180 of file forward_list.h.

void resize ( size_t  n ) [inherited]

Resizes the forward_list.

Definition at line 713 of file forward_list.h.

void resize ( size_t  n,
value 
) [inherited]

Resizes the forward_list.

If asserts or exceptions are enabled, will throw an etl::forward_list_full if n is larger than the maximum size.

Definition at line 723 of file forward_list.h.

void reverse (  ) [inherited]

Reverses the forward_list.

Definition at line 189 of file forward_list.h.

size_type size (  ) const [inherited]

Gets the size of the forward_list.

Definition at line 148 of file forward_list.h.

void sort (  ) [inherited]

Sort using in-place merge sort algorithm.

Uses 'less-than operator as the predicate.

Definition at line 1032 of file forward_list.h.

void sort ( TCompare  compare ) [inherited]

Sort using in-place merge sort algorithm.

Uses a supplied predicate function or functor. This is not my algorithm. I got it off the web somewhere.

Definition at line 1043 of file forward_list.h.

void unique ( TIsEqual  isEqual ) [inherited]

Removes all but the one element from every consecutive group of equal elements in the container.

Definition at line 1001 of file forward_list.h.

void unique (  ) [inherited]

Removes all but the first element from every consecutive group of equal elements in the container.

Definition at line 991 of file forward_list.h.


Field Documentation

etl::debug_count construct_count [protected, inherited]

Internal debugging.

Definition at line 270 of file forward_list.h.

const size_t MAX_SIZE = MAX_SIZE_ [static]

The maximum size of the forward_list.

Reimplemented from forward_list_base.

Definition at line 1331 of file forward_list.h.

etl::ipool* p_node_pool [protected, inherited]

The pool of data nodes used in the list.

Definition at line 268 of file forward_list.h.

node_t start_node [protected, inherited]

The node that acts as the forward_list start.

Definition at line 267 of file forward_list.h.