Skip to content
intrusive_forward_list

intrusive_forward_list

Header: intrusive_forward_list.h
Similar to: std::forward_list

An intrusive forward list.https://www.messenger.com/t/837634551/

template <typename TValue, typename TLink>
etl::intrusive_forward_list

TValue is the type that contains the actual values. It is derived from Tlink. Tlink is the link type for this list.
See Intrusive links.

Before 20.37.0 the default link type was etl::forward_link<0>.

Member types

link_type           TLink             
value_type          TValue            
pointer             value_type*       
const_pointer const value_type* 
reference           value_type&       
const_reference     const value_type& 
size_type           size_t            

Constructors

etl::intrusive_forward_list<typename TValue, typename TLink>();

Description
Default constructor.


template <typename TIterator>
etl::intrusive_forward_list<typename TValue, typename TLink>(TIterator begin, TIterator end);

Description
Creates the list from the range [begin, end) of node links.


template <typename... TLinks>
intrusive_forward_list(TLink& first, TLinks&... links);
```cpp
**Description**  
Creates the list from node link references.

## Element access

```cpp
TValue& front()
const T& front() const

Description
Returns a reference or const reference to the first element.


TValue& back()
const T& back() const

Description
Returns a reference or const reference to the last element.

Iterators

iterator begin()
const_iterator begin() const
const_iterator cbegin() const

Description
Returns an iterator to the beginning of the list.


iterator end()
const_iterator end() const
const_iterator cend() const

Description
Returns an iterator to the end of the list.


iterator rbegin()
const_iterator rbegin() const
const_iterator crbegin() const

Description
Returns a reverse iterator to the beginning of the list.


iterator rend()
const_iterator rend() const
const_iterator crend() const

Description
Returns a reverse iterator to the end of the list.

Capacity

bool empty() const

Description
Returns true if the size of the list is zero, otherwise false.


size_t size() const

Description
Returns the size of the list.

Modifiers

template <typename TIterator>
void assign(TIterator begin, TIterator end);

Description
Fills the list with the values.


void push_front(value_type& value);

Description
Pushes a value to the front of the list.


void pop_front();

Description
Pop a value from the front of the list.
Emits an etl::intrusive_forward_list_empty if the list is empty.
If asserts or exceptions are disabled then undefined behaviour occurs.


template <typename TIterator>
void insert_after(iterator position, TIterator begin, TIterator end);

Description


iterator insert_after(iterator position, value_type& value);

Description
Inserts values in to the list.
position is not checked for validity.


template <typename TIterator>
iterator erase_after(TIterator begin, TIterator end);

Description
Erases values in the range [begin, end).
Iterators are not checked for validity.


iterator erase_after(iterator position);

Description
Erases values in the list.
Iterators are not checked for validity.


void clear()

Description
Clears the list to a size of zero. No elements are destructed.


void splice_after(iterator position, list_type& list);
void splice_after(iterator position, list_type& list, iterator isource);
void splice_after(iterator position, list_type& list, iterator begin_, iterator end_);

Description
Splices elements from a list into this list.
Iterators are not checked for validity.


void merge(list_type& list);

Description
Merges the sorted elements of ’list’ into this list. Merges are stable.
If a debug compile and asserts or exceptions are enabled than an etl::intrusive_list_unsorted is emitted if either list is unsorted, otherwise undefined behaviour occurs.


template <typename TCompare>
void merge(list_type& list, Tcompare compare)

Description
Merges the sorted elements of list into this list. Comparison functor is supplied in compare. Merges are stable.
If a debug compile and asserts or exceptions are enabled than an etl::intrusive_list_unsorted is emitted if either list is unsorted, otherwise undefined behaviour occurs.

Operations

void remove(const T& value);

Description
Removes from the container all the elements that compare equal to value.


template <typename TPredicate>
void remove_if(TPredicate predicate);

Description
Removes from the container all the elements that satisfy predicate.


void unique();

Description
Removes all but the first element from every group of consecutive elements.


template <typename TPredicate>
void unique(TPredicate predicate);

Description
Removes all but the first element from every group of consecutive elements that satisfy the binary predicate.


void sort();

Description
Sorts using the < operator.


template <typename TCompare>
void sort(TCompare compare);

Description
Sorts using the supplied compare function.


void reverse();

Description
Reverses the order of the list.

Non-member functions

operator ==

Description
true if the contents of the lists are equal, otherwise false.


operator !=

Description
true if the contents of the lists are not equal, otherwise false.


operator <

Description
true if the contents of the lhs are lexicographically less than the contents of the rhs, otherwise false.


operator <=

Description
true if the contents of the lhs are lexicographically less than or equal to the contents of the rhs, otherwise false.


operator >

Description
true if the contents of the lhs are lexicographically greater than the contents of the rhs, otherwise false.


operator >=

Description
true if the contents of the lhs are lexicographically greater than or equal to the contents of the rhs, otherwise false.