Stefan Scholz / ETL
Embed: (wiki syntax)

« Back to documentation index

list< T, MAX_SIZE_ > Class Template Reference

A templated list implementation that uses a fixed size buffer. More...

#include <list.h>

Inherits etl::ilist< T >.

Public Types

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

Public Member Functions

 list ()
 Default constructor.
 ~list ()
 Destructor.
 list (size_t initial_size)
 Construct from size.
 list (size_t initial_size, typename ilist< T >::parameter_t value)
 Construct from size and value.
 list (const list &other)
 Copy constructor.
template<typename TIterator >
 list (TIterator first, TIterator last)
 Construct from range.
listoperator= (const list &rhs)
 Assignment operator.
iterator begin ()
 Gets the beginning of the list.
const_iterator begin () const
 Gets the beginning of the list.
iterator end ()
 Gets the end of the list.
const_iterator end () const
 Gets the end of the list.
const_iterator cbegin () const
 Gets the beginning of the list.
const_iterator cend () const
 Gets the end of the list.
reverse_iterator rbegin ()
 Gets the reverse beginning of the list.
const_reverse_iterator rbegin () const
 Gets the reverse beginning of the list.
reverse_iterator rend ()
 Gets the reverse end of the list.
const_reverse_iterator crbegin () const
 Gets the reverse beginning of the list.
const_reverse_iterator crend () const
 Gets the reverse end of the list.
reference front ()
 Gets a reference to the first element.
const_reference front () const
 Gets a const reference to the first element.
reference back ()
 Gets a reference to the last element.
const_reference back () const
 Gets a reference to the last element.
template<typename TIterator >
void assign (TIterator first, TIterator last)
 Assigns a range of values to the list.
void assign (size_t n, parameter_t value)
 Assigns 'n' copies of a value to the list.
void push_front ()
 Adds a node to the front of the list so a new value can be assigned to front().
void push_front (parameter_t value)
 Pushes a value to the front of the 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 list.
void push_back ()
 Adds a node to the back of the list so a new value can be assigned to back().
void push_back (parameter_t value)
 Pushes a value to the back of the list..
template<typename T1 >
void emplace_back (const T1 &value1)
 Emplaces a value to the back of the list..
template<typename T1 , typename T2 >
void emplace_back (const T1 &value1, const T2 &value2)
 Emplaces a value to the back of the list..
template<typename T1 , typename T2 , typename T3 >
void emplace_back (const T1 &value1, const T2 &value2, const T3 &value3)
 Emplaces a value to the back of the list..
template<typename T1 , typename T2 , typename T3 , typename T4 >
void emplace_back (const T1 &value1, const T2 &value2, const T3 &value3, const T4 &value4)
 Emplaces a value to the back of the list..
void pop_back ()
 Removes a value from the back of the list.
iterator insert (iterator position, const value_type &value)
 Inserts a value to the list at the specified position.
void insert (iterator position, size_t n, const value_type &value)
 Inserts 'n' copies of a value to the list at the specified position.
template<typename TIterator >
void insert (iterator position, TIterator first, TIterator last)
 Inserts a range of values to the list at the specified position.
template<typename T1 >
iterator emplace (iterator position, const T1 &value1)
 Emplaces a value to the list at the specified position.
template<typename T1 , typename T2 >
iterator emplace (iterator position, const T1 &value1, const T2 &value2)
 Emplaces a value to the list at the specified position.
template<typename T1 , typename T2 , typename T3 >
iterator emplace (iterator position, const T1 &value1, const T2 &value2, const T3 &value3)
 Emplaces a value to the list at the specified position.
template<typename T1 , typename T2 , typename T3 , typename T4 >
iterator emplace (iterator position, const T1 &value1, const T2 &value2, const T3 &value3, const T4 &value4)
 Emplaces a value to the list at the specified position.
iterator erase (iterator position)
 Erases the value at the specified position.
iterator erase (iterator first, iterator last)
 Erases a range of elements.
void resize (size_t n)
 Resizes the list.
void resize (size_t n, parameter_t value)
 Resizes the list.
void clear ()
 Clears the list.
template<typename TPredicate >
void remove_if (TPredicate predicate)
 Removes according to a predicate.
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 first element from every consecutive group of equal elements in the container.
void splice (iterator to, ilist &other)
 Splices from another list to this.
void splice (iterator to, ilist &other, iterator from)
 Splices an element from another list to this.
void splice (iterator to, ilist &other, iterator first, iterator last)
 Splices a range of elements from another list to this.
void merge (ilist &other)
 Merge another list into this one. Both lists should be sorted.
template<typename TCompare >
void merge (ilist &other, TCompare compare)
 Merge another list into this one. Both lists should be sorted.
void sort ()
 Sort using in-place merge sort algorithm.
template<typename TCompare >
void sort (TCompare compare)
 Sort using in-place merge sort algorithm.
void reverse ()
 Reverses the list.
size_type max_size () const
 Gets the maximum possible size of the list.
size_type size () const
 Gets the size of the list.
bool empty () const
 Checks to see if the list is empty.
bool full () const
 Checks to see if the list is full.
size_t available () const
 Returns the remaining capacity.
bool is_trivial_list () const
 Is the list a trivial length?

Static Public Attributes

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

Protected Member Functions

void initialise ()
 Initialise the list.
node_tget_head ()
 Get the head node.
const node_tget_head () const
 Get the head node.
node_tget_tail ()
 Get the tail node.
const node_tget_tail () const
 Get the tail node.
void insert_node (node_t &position, node_t &node)
 Insert a node before 'position'.
void join (node_t &left, node_t &right)
 Join two nodes.

Protected Attributes

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

Detailed Description

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

A templated list implementation that uses a fixed size buffer.

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

Definition at line 1557 of file list.h.


Member Typedef Documentation

typedef size_t size_type

The type used for determining the size of list.

Reimplemented from ilist< T >.

Definition at line 1570 of file list.h.


Constructor & Destructor Documentation

list (  )

Default constructor.

Definition at line 1575 of file list.h.

~list (  )

Destructor.

Definition at line 1584 of file list.h.

list ( size_t  initial_size ) [explicit]

Construct from size.

Definition at line 1592 of file list.h.

list ( size_t  initial_size,
typename ilist< T >::parameter_t  value 
)

Construct from size and value.

Definition at line 1601 of file list.h.

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

Copy constructor.

Definition at line 1610 of file list.h.

list ( TIterator  first,
TIterator  last 
)

Construct from range.

Definition at line 1623 of file list.h.


Member Function Documentation

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

Assigns a range of values to the list.

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

Definition at line 712 of file list.h.

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

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

Definition at line 734 of file list.h.

size_t available (  ) const [inherited]

Returns the remaining capacity.

Returns:
The remaining capacity.

Definition at line 233 of file list.h.

reference back (  ) [inherited]

Gets a reference to the last element.

Definition at line 693 of file list.h.

const_reference back (  ) const [inherited]

Gets a reference to the last element.

Definition at line 701 of file list.h.

iterator begin (  ) [inherited]

Gets the beginning of the list.

Definition at line 589 of file list.h.

const_iterator begin (  ) const [inherited]

Gets the beginning of the list.

Definition at line 597 of file list.h.

const_iterator cbegin (  ) const [inherited]

Gets the beginning of the list.

Definition at line 621 of file list.h.

const_iterator cend (  ) const [inherited]

Gets the end of the list.

Definition at line 629 of file list.h.

void clear (  ) [inherited]

Clears the list.

Definition at line 1104 of file list.h.

const_reverse_iterator crbegin (  ) const [inherited]

Gets the reverse beginning of the list.

Definition at line 661 of file list.h.

const_reverse_iterator crend (  ) const [inherited]

Gets the reverse end of the list.

Definition at line 669 of file list.h.

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

Emplaces a value to the list at the specified position.

Definition at line 950 of file list.h.

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

Emplaces a value to the list at the specified position.

Definition at line 966 of file list.h.

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

Emplaces a value to the list at the specified position.

Definition at line 982 of file list.h.

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

Emplaces a value to the list at the specified position.

Definition at line 998 of file list.h.

void emplace_back ( const T1 &  value1 ) [inherited]

Emplaces a value to the back of the list..

Definition at line 865 of file list.h.

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

Emplaces a value to the back of the list..

Definition at line 880 of file list.h.

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

Emplaces a value to the back of the list..

Definition at line 895 of file list.h.

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

Emplaces a value to the back of the list..

Definition at line 910 of file list.h.

void emplace_front ( const T1 &  value1 ) [inherited]

Emplaces a value to the front of the list..

Definition at line 774 of file list.h.

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

Emplaces a value to the front of the list..

Definition at line 789 of file 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 804 of file 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 819 of file list.h.

bool empty (  ) const [inherited]

Checks to see if the list is empty.

Definition at line 216 of file list.h.

iterator end (  ) [inherited]

Gets the end of the list.

Definition at line 605 of file list.h.

const_iterator end (  ) const [inherited]

Gets the end of the list.

Definition at line 613 of file list.h.

iterator erase ( iterator  position ) [inherited]

Erases the value at the specified position.

Definition at line 1042 of file list.h.

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

Erases a range of elements.

Definition at line 1052 of file list.h.

reference front (  ) [inherited]

Gets a reference to the first element.

Definition at line 677 of file list.h.

const_reference front (  ) const [inherited]

Gets a const reference to the first element.

Definition at line 685 of file list.h.

bool full (  ) const [inherited]

Checks to see if the list is full.

Definition at line 224 of file list.h.

node_t& get_head (  ) [protected, inherited]

Get the head node.

Definition at line 251 of file list.h.

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

Get the head node.

Definition at line 259 of file list.h.

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

Get the tail node.

Definition at line 275 of file list.h.

node_t& get_tail (  ) [protected, inherited]

Get the tail node.

Definition at line 267 of file list.h.

void initialise (  ) [protected, inherited]

Initialise the list.

Definition at line 1441 of file list.h.

void insert ( iterator  position,
size_t  n,
const value_type &  value 
) [inherited]

Inserts 'n' copies of a value to the list at the specified position.

Definition at line 1013 of file list.h.

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

Inserts a range of values to the list at the specified position.

Definition at line 1028 of file list.h.

iterator insert ( iterator  position,
const value_type &  value 
) [inherited]

Inserts a value to the list at the specified position.

Definition at line 936 of file list.h.

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

Insert a node before 'position'.

Definition at line 283 of file list.h.

bool is_trivial_list (  ) const [inherited]

Is the list a trivial length?

Definition at line 241 of file list.h.

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

Join two nodes.

Definition at line 293 of file list.h.

size_type max_size (  ) const [inherited]

Gets the maximum possible size of the list.

Definition at line 200 of file list.h.

void merge ( ilist< T > &  other ) [inherited]

Merge another list into this one. Both lists should be sorted.

Definition at line 1240 of file list.h.

void merge ( ilist< T > &  other,
TCompare  compare 
) [inherited]

Merge another list into this one. Both lists should be sorted.

Definition at line 1249 of file list.h.

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

Assignment operator.

Definition at line 1632 of file list.h.

void pop_back (  ) [inherited]

Removes a value from the back of the list.

Definition at line 924 of file list.h.

void pop_front (  ) [inherited]

Removes a value from the front of the list.

Definition at line 833 of file list.h.

void push_back ( parameter_t  value ) [inherited]

Pushes a value to the back of the list..

Definition at line 853 of file list.h.

void push_back (  ) [inherited]

Adds a node to the back of the list so a new value can be assigned to back().

Definition at line 845 of file list.h.

void push_front (  ) [inherited]

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

Definition at line 754 of file list.h.

void push_front ( parameter_t  value ) [inherited]

Pushes a value to the front of the list.

Definition at line 762 of file list.h.

const_reverse_iterator rbegin (  ) const [inherited]

Gets the reverse beginning of the list.

Definition at line 645 of file list.h.

reverse_iterator rbegin (  ) [inherited]

Gets the reverse beginning of the list.

Definition at line 637 of file list.h.

void remove_if ( TPredicate  predicate ) [inherited]

Removes according to a predicate.

Definition at line 1133 of file list.h.

reverse_iterator rend (  ) [inherited]

Gets the reverse end of the list.

Definition at line 653 of file list.h.

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

Resizes the list.

Definition at line 1083 of file list.h.

void resize ( size_t  n ) [inherited]

Resizes the list.

Definition at line 1075 of file list.h.

void reverse (  ) [inherited]

Reverses the list.

Definition at line 174 of file list.h.

size_type size (  ) const [inherited]

Gets the size of the list.

Definition at line 208 of file list.h.

void sort (  ) [inherited]

Sort using in-place merge sort algorithm.

Uses 'less-than operator as the predicate.

Definition at line 1297 of file 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 1308 of file list.h.

void splice ( iterator  to,
ilist< T > &  other 
) [inherited]

Splices from another list to this.

Definition at line 1192 of file list.h.

void splice ( iterator  to,
ilist< T > &  other,
iterator  first,
iterator  last 
) [inherited]

Splices a range of elements from another list to this.

Definition at line 1222 of file list.h.

void splice ( iterator  to,
ilist< T > &  other,
iterator  from 
) [inherited]

Splices an element from another list to this.

Definition at line 1204 of file list.h.

void unique ( TIsEqual  isEqual ) [inherited]

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

Definition at line 1164 of file list.h.

void unique (  ) [inherited]

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

Definition at line 1154 of file list.h.


Field Documentation

etl::debug_count construct_count [protected, inherited]

Internal debugging.

Definition at line 312 of file list.h.

const size_t MAX_SIZE = MAX_SIZE_ [static]

The maximum size of the list.

Reimplemented from list_base.

Definition at line 1561 of file list.h.

etl::ipool* p_node_pool [protected, inherited]

The pool of data nodes used in the list.

Definition at line 309 of file list.h.

node_t terminal_node [protected, inherited]

The node that acts as the list start and end.

Definition at line 310 of file list.h.