Loading...
Searching...
No Matches
forward_list

## Classes

class | etl::forward_list_exception
class | etl::forward_list_full
class | etl::forward_list_empty
class | etl::forward_list_iterator
class | etl::forward_list_no_pool
class | etl::forward_list_base
class | etl::iforward_list< T >

## Detailed Description

A linked forward_list with the capacity defined at compile time.

## Class Documentation

## etl::forward_list_exception

class etl::forward_list_exception

Exception for the forward_list.

### Public Member Functions

| forward_list_exception (string_type reason_, string_type file_name_, numeric_type line_number_)
Public Member Functions inherited from etl::exception
ETL_EXCEPTION_CONSTEXPR | exception (string_type reason_, string_type, numeric_type)
| Constructor.
ETL_EXCEPTION_CONSTEXPR string_type | what () const ETL_NOEXCEPT ETL_EXCEPTION_OVERRIDE
ETL_EXCEPTION_CONSTEXPR string_type | file_name () const
ETL_EXCEPTION_CONSTEXPR numeric_type | line_number () const

## Additional Inherited Members

Public Types inherited from etl::exception
typedef const char * | string_type
typedef int | numeric_type

## etl::forward_list_full

class etl::forward_list_full

Full exception for the forward_list.

### Public Member Functions

| forward_list_full (string_type file_name_, numeric_type line_number_)
Public Member Functions inherited from etl::forward_list_exception
| forward_list_exception (string_type reason_, string_type file_name_, numeric_type line_number_)
Public Member Functions inherited from etl::exception
ETL_EXCEPTION_CONSTEXPR | exception (string_type reason_, string_type, numeric_type)
| Constructor.
ETL_EXCEPTION_CONSTEXPR string_type | what () const ETL_NOEXCEPT ETL_EXCEPTION_OVERRIDE
ETL_EXCEPTION_CONSTEXPR string_type | file_name () const
ETL_EXCEPTION_CONSTEXPR numeric_type | line_number () const

## Additional Inherited Members

Public Types inherited from etl::exception
typedef const char * | string_type
typedef int | numeric_type

## etl::forward_list_empty

class etl::forward_list_empty

Empty exception for the forward_list.

### Public Member Functions

| forward_list_empty (string_type file_name_, numeric_type line_number_)
Public Member Functions inherited from etl::forward_list_exception
| forward_list_exception (string_type reason_, string_type file_name_, numeric_type line_number_)
Public Member Functions inherited from etl::exception
ETL_EXCEPTION_CONSTEXPR | exception (string_type reason_, string_type, numeric_type)
| Constructor.
ETL_EXCEPTION_CONSTEXPR string_type | what () const ETL_NOEXCEPT ETL_EXCEPTION_OVERRIDE
ETL_EXCEPTION_CONSTEXPR string_type | file_name () const
ETL_EXCEPTION_CONSTEXPR numeric_type | line_number () const

## Additional Inherited Members

Public Types inherited from etl::exception
typedef const char * | string_type
typedef int | numeric_type

## etl::forward_list_iterator

class etl::forward_list_iterator

Iterator exception for the forward_list.

### Public Member Functions

| forward_list_iterator (string_type file_name_, numeric_type line_number_)
Public Member Functions inherited from etl::forward_list_exception
| forward_list_exception (string_type reason_, string_type file_name_, numeric_type line_number_)
Public Member Functions inherited from etl::exception
ETL_EXCEPTION_CONSTEXPR | exception (string_type reason_, string_type, numeric_type)
| Constructor.
ETL_EXCEPTION_CONSTEXPR string_type | what () const ETL_NOEXCEPT ETL_EXCEPTION_OVERRIDE
ETL_EXCEPTION_CONSTEXPR string_type | file_name () const
ETL_EXCEPTION_CONSTEXPR numeric_type | line_number () const

## Additional Inherited Members

Public Types inherited from etl::exception
typedef const char * | string_type
typedef int | numeric_type

## etl::forward_list_no_pool

class etl::forward_list_no_pool

Unsorted exception for the forward_list.

### Public Member Functions

| forward_list_no_pool (string_type file_name_, numeric_type line_number_)
Public Member Functions inherited from etl::forward_list_exception
| forward_list_exception (string_type reason_, string_type file_name_, numeric_type line_number_)
Public Member Functions inherited from etl::exception
ETL_EXCEPTION_CONSTEXPR | exception (string_type reason_, string_type, numeric_type)
| Constructor.
ETL_EXCEPTION_CONSTEXPR string_type | what () const ETL_NOEXCEPT ETL_EXCEPTION_OVERRIDE
ETL_EXCEPTION_CONSTEXPR string_type | file_name () const
ETL_EXCEPTION_CONSTEXPR numeric_type | line_number () const

## Additional Inherited Members

Public Types inherited from etl::exception
typedef const char * | string_type
typedef int | numeric_type

## etl::forward_list_base

class etl::forward_list_base

The base class for all forward_lists.

### Public Types

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

### Public Member Functions

bool | has_shared_pool () const
| true if the list has a shared pool.
size_type | max_size () const
| Gets the maximum possible size of the forward_list.
size_type | capacity () const
| Gets the maximum possible size of the forward_list.
size_type | size () const
| Gets the 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
void | reverse ()
| Reverses the forward_list.

### Protected Member Functions

| forward_list_base (bool pool_is_shared_)
| The constructor that is called from derived classes.
| forward_list_base (etl::ipool &node_pool_, size_type max_size_, bool pool_is_shared_)
| The constructor that is called from derived classes.
| ~forward_list_base ()
| Destructor.
node_t * | get_head ()
| Get the head node.
const node_t * | get_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.
void | set_node_pool (etl::ipool &node_pool_)
| Set the node pool instance.
etl::ipool * | get_node_pool ()
| Get the node pool instance.

### 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.
size_type | MAX_SIZE
| The maximum size of the forward_list.
bool | pool_is_shared
| If true then the pool is shared between lists.
| ETL_DECLARE_DEBUG_COUNT
| Internal debugging.

#### Member Function Documentation

## available()

size_t etl::forward_list_base::available | ( |  | ) | const

inline

Returns the remaining capacity.

Returns
  The remaining capacity.

## etl::iforward_list

class etl::iforward_list

template<typename T>
class etl::iforward_list< T >

A templated base for all etl::forward_list types.

### Public Types

typedef T | value_type
typedef T * | pointer
typedef const T * | const_pointer
typedef T & | reference
typedef const T & | const_reference
typedef size_t | size_type
typedef etl::iterator_traits< iterator >::difference_type | difference_type
Public Types inherited from etl::forward_list_base
typedef size_t | size_type
| The type used for determining the size of forward_list.

### Public Member Functions

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 ()
const_reference | front () const
template<typename TIterator>
void | assign (TIterator first, TIterator last, typename etl::enable_if<!etl::is_integral< TIterator >::value, int >::type=0)
void | assign (size_t n, const T &value)
| Assigns 'n' copies of a value to the forward_list.
void | push_front (const T &value)
| Pushes a value to the front of the forward_list.
reference | emplace_front ()
| Emplaces a value to the front of the list..
template<typename T1>
reference | emplace_front (const T1 &value1)
| Emplaces a value to the front of the list..
template<typename T1, typename T2>
reference | emplace_front (const T1 &value1, const T2 &value2)
| Emplaces a value to the front of the list..
template<typename T1, typename T2, typename T3>
reference | 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>
reference | 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)
iterator | insert_after (const_iterator position, const T &value)
| Inserts a value to the forward_list after the specified position.
iterator | emplace_after (const_iterator position)
| Emplaces a value to the forward_list after the specified position.
template<typename T1>
iterator | emplace_after (const_iterator position, const T1 &value1)
| Emplaces a value to the forward_list after the specified position.
template<typename T1, typename T2>
iterator | emplace_after (const_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 (const_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 (const_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 | insert_after (const_iterator position, size_t n, const T &value)
template<typename TIterator>
iterator | insert_after (const_iterator position, TIterator first, TIterator last, typename etl::enable_if<!etl::is_integral< TIterator >::value, int >::type=0)
iterator | erase_after (iterator position)
| Erases the value at the specified position.
iterator | erase_after (const_iterator position)
| Erases the value at the specified position.
iterator | erase_after (const_iterator first, const_iterator last)
| Erases a range of elements.
void | move_after (const_iterator from_before, const_iterator to_before)
void | move_after (const_iterator first_before, const_iterator last, const_iterator to_before)
void | unique ()
template<typename TIsEqual>
void | unique (TIsEqual isEqual)
void | sort ()
template<typename TCompare>
void | sort (TCompare compare)
void | remove (const T &value)
template<typename TPredicate>
void | remove_if (TPredicate predicate)
| Removes according to a predicate.
iforward_list & | operator= (const iforward_list &rhs)
| Assignment operator.
Public Member Functions inherited from etl::forward_list_base
bool | has_shared_pool () const
| true if the list has a shared pool.
size_type | max_size () const
| Gets the maximum possible size of the forward_list.
size_type | capacity () const
| Gets the maximum possible size of the forward_list.
size_type | size () const
| Gets the 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
void | reverse ()
| Reverses the forward_list.

### Protected Member Functions

| iforward_list (bool pool_is_shared_)
| Constructor.
| iforward_list (etl::ipool &node_pool, size_t max_size_, bool pool_is_shared_)
| Constructor.
void | initialise ()
| Initialise the forward_list.
data_node_t & | allocate_data_node (const_reference value)
| Allocate a data_node_t.
| ~iforward_list ()
| Destructor.
Protected Member Functions inherited from etl::forward_list_base
| forward_list_base (bool pool_is_shared_)
| The constructor that is called from derived classes.
| forward_list_base (etl::ipool &node_pool_, size_type max_size_, bool pool_is_shared_)
| The constructor that is called from derived classes.
| ~forward_list_base ()
| Destructor.
node_t * | get_head ()
| Get the head node.
const node_t * | get_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.
void | set_node_pool (etl::ipool &node_pool_)
| Set the node pool instance.
etl::ipool * | get_node_pool ()
| Get the node pool instance.

## Additional Inherited Members

Protected Attributes inherited from etl::forward_list_base
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.
size_type | MAX_SIZE
| The maximum size of the forward_list.
bool | pool_is_shared
| If true then the pool is shared between lists.
| ETL_DECLARE_DEBUG_COUNT
| Internal debugging.

#### Member Function Documentation

## assign()

template<typename T>
template<typename TIterator>

void etl::iforward_list< T >::assign | ( | TIterator | first,
|  | TIterator | last,
|  | typename etl::enable_if<!etl::is_integral< TIterator >::value, int >::type | = 0 )

inline

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.

## front() [1/2]

template<typename T>

reference etl::iforward_list< T >::front | ( |  | ) |

inline

Gets a reference to the first element. If asserts or exceptions are enabled, throws an etl::forward_list_empty if the list is empty.

## front() [2/2]

template<typename T>

const_reference etl::iforward_list< T >::front | ( |  | ) | const

inline

Gets a const reference to the first element. If asserts or exceptions are enabled, throws an etl::forward_list_empty if the list is empty.

## insert_after() [1/2]

template<typename T>

iterator etl::iforward_list< T >::insert_after | ( | const_iterator | position,
|  | size_t | n,
|  | const T & | value )

inline

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

## insert_after() [2/2]

template<typename T>
template<typename TIterator>

iterator etl::iforward_list< T >::insert_after | ( | const_iterator | position,
|  | TIterator | first,
|  | TIterator | last,
|  | typename etl::enable_if<!etl::is_integral< TIterator >::value, int >::type | = 0 )

inline

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

## move_after() [1/2]

template<typename T>

void etl::iforward_list< T >::move_after | ( | const_iterator | first_before,
|  | const_iterator | last,
|  | const_iterator | to_before )

inline

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'.

## move_after() [2/2]

template<typename T>

void etl::iforward_list< T >::move_after | ( | const_iterator | from_before,
|  | const_iterator | to_before )

inline

Moves a range from one position to another within the list. Moves a range at position 'first_before' to the position before 'to_before'.

## resize()

template<typename T>

void etl::iforward_list< T >::resize | ( | size_t | n,
|  | T | value )

inline

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.

## sort() [1/2]

template<typename T>

void etl::iforward_list< T >::sort | ( |  | ) |

inline

Sort using in-place merge sort algorithm. Uses 'less-than operator as the predicate.

## sort() [2/2]

template<typename T>
template<typename TCompare>

void etl::iforward_list< T >::sort | ( | TCompare | compare | ) |

inline

Stable sort using in-place merge sort algorithm. Copyright 2001 Simon Tatham.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL SIMON TATHAM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

## unique() [1/2]

template<typename T>

void etl::iforward_list< T >::unique | ( |  | ) |

inline

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

## unique() [2/2]

template<typename T>
template<typename TIsEqual>

void etl::iforward_list< T >::unique | ( | TIsEqual | isEqual | ) |

inline

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