Stefan Scholz / ETL
Embed: (wiki syntax)

« Back to documentation index

intrusive_list< TValue, TLink > Class Template Reference

intrusive_list< TValue, TLink > Class Template Reference

An intrusive list. More...

#include <intrusive_list.h>

Inherits etl::intrusive_list_base< TLink >.

Data Structures

class  const_iterator
 const_iterator More...
class  iterator
 iterator. More...

Public Member Functions

 intrusive_list ()
 Constructor.
 ~intrusive_list ()
 Destructor.
template<typename TIterator >
 intrusive_list (TIterator first, TIterator last)
 Constructor from range.
iterator begin ()
 Gets the beginning of the intrusive_list.
const_iterator begin () const
 Gets the beginning of the intrusive_list.
const_iterator cbegin () const
 Gets the beginning of the intrusive_list.
iterator end ()
 Gets the end of the intrusive_list.
const_iterator end () const
 Gets the end of the intrusive_list.
const_iterator cend () const
 Gets the end of the intrusive_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 const reference to the last element.
iterator insert (iterator position, value_type &value)
 Inserts a value to the intrusive_list before the specified position.
template<typename TIterator >
void insert (iterator position, TIterator first, TIterator last)
 Inserts a range of values to the intrusive_list after 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.
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.
void splice (iterator position, list_type &other)
 Splice another list into this one.
void splice (iterator position, list_type &other, iterator isource)
 Splice an element from another list into this one.
void splice (iterator position, list_type &other, iterator begin_, iterator end_)
 Splice a range of elements from another list into this one.
void merge (list_type &other)
 Merge another list into this one. Both lists should be sorted.
template<typename TCompare >
void merge (list_type &other, TCompare compare)
 Merge another list into this one. Both lists should be sorted.
template<typename TIterator >
void assign (TIterator first, TIterator last)
 Assigns a range of values to the intrusive_list.
void push_front (link_type &value)
 Pushes a value to the front of the intrusive_list.
void pop_front ()
 Removes a value from the front of the intrusive_list.
void push_back (link_type &value)
 Pushes a value to the back of the intrusive_list.
void pop_back ()
 Removes a value from the back of the intrusive_list.
void clear ()
 Clears the intrusive_list.
void reverse ()
 Reverses the list.
bool empty () const
 Returns true if the list has no elements.
size_t size () const
 Returns the number of elements.

Protected Member Functions

bool is_trivial_list () const
 Is the intrusive_list a trivial length?
void insert_link (link_type &previous, link_type &new_link)
 Insert a link.
void insert_link (link_type *previous, link_type &new_link)
 Insert a link.
void insert_link (link_type &previous, link_type *new_link)
 Insert a link.
void insert_link (link_type *previous, link_type *new_link)
 Insert a link.
void remove_link (link_type &link)
 Remove a link.
void remove_link (link_type *link)
 Remove a link.
link_type * get_head ()
 Get the head link.
const link_type * get_head () const
 Get the head link.
link_type * get_tail ()
 Get the tail link.
const link_type * get_tail () const
 Get the tail link.
void initialise ()
 Initialise the intrusive_list.

Protected Attributes

link_type terminal_link
 The link that acts as the intrusive_list start & end.
size_t current_size
 Counts the number of elements in the list.

Detailed Description

template<typename TValue, typename TLink = etl::bidirectional_link<0>>
class etl::intrusive_list< TValue, TLink >

An intrusive list.

Note:
TLink must be a base of TValue.

Definition at line 359 of file intrusive_list.h.


Constructor & Destructor Documentation

Constructor.

Definition at line 581 of file intrusive_list.h.

Destructor.

Definition at line 589 of file intrusive_list.h.

intrusive_list ( TIterator  first,
TIterator  last 
)

Constructor from range.

Definition at line 598 of file intrusive_list.h.


Member Function Documentation

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

Assigns a range of values to the intrusive_list.

If ETL_THROW_EXCEPTIONS & ETL_DEBUG are defined emits a intrusive_list_iterator_exception if the iterators are reversed.

Definition at line 133 of file intrusive_list.h.

const_reference back (  ) const

Gets a const reference to the last element.

Definition at line 678 of file intrusive_list.h.

reference back (  )

Gets a reference to the last element.

Definition at line 670 of file intrusive_list.h.

const_iterator begin (  ) const

Gets the beginning of the intrusive_list.

Definition at line 614 of file intrusive_list.h.

iterator begin (  )

Gets the beginning of the intrusive_list.

Definition at line 606 of file intrusive_list.h.

const_iterator cbegin (  ) const

Gets the beginning of the intrusive_list.

Definition at line 622 of file intrusive_list.h.

const_iterator cend (  ) const

Gets the end of the intrusive_list.

Definition at line 646 of file intrusive_list.h.

void clear (  ) [inherited]

Clears the intrusive_list.

Definition at line 195 of file intrusive_list.h.

bool empty (  ) const [inherited]

Returns true if the list has no elements.

Definition at line 225 of file intrusive_list.h.

iterator end (  )

Gets the end of the intrusive_list.

Definition at line 630 of file intrusive_list.h.

const_iterator end (  ) const

Gets the end of the intrusive_list.

Definition at line 638 of file intrusive_list.h.

iterator erase ( iterator  position )

Erases the value at the specified position.

Definition at line 708 of file intrusive_list.h.

iterator erase ( iterator  first,
iterator  last 
)

Erases a range of elements.

Clears the links after erasing if AUTO or CHECKED.

Definition at line 722 of file intrusive_list.h.

const_reference front (  ) const

Gets a const reference to the first element.

Definition at line 662 of file intrusive_list.h.

reference front (  )

Gets a reference to the first element.

Definition at line 654 of file intrusive_list.h.

link_type* get_head (  ) [protected, inherited]

Get the head link.

Definition at line 314 of file intrusive_list.h.

const link_type* get_head (  ) const [protected, inherited]

Get the head link.

Definition at line 322 of file intrusive_list.h.

link_type* get_tail (  ) [protected, inherited]

Get the tail link.

Definition at line 330 of file intrusive_list.h.

const link_type* get_tail (  ) const [protected, inherited]

Get the tail link.

Definition at line 338 of file intrusive_list.h.

void initialise (  ) [protected, inherited]

Initialise the intrusive_list.

Definition at line 346 of file intrusive_list.h.

iterator insert ( iterator  position,
value_type &  value 
)

Inserts a value to the intrusive_list before the specified position.

Definition at line 686 of file intrusive_list.h.

void insert ( iterator  position,
TIterator  first,
TIterator  last 
)

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

Definition at line 696 of file intrusive_list.h.

void insert_link ( link_type &  previous,
link_type &  new_link 
) [protected, inherited]

Insert a link.

Definition at line 256 of file intrusive_list.h.

void insert_link ( link_type *  previous,
link_type &  new_link 
) [protected, inherited]

Insert a link.

Definition at line 266 of file intrusive_list.h.

void insert_link ( link_type &  previous,
link_type *  new_link 
) [protected, inherited]

Insert a link.

Definition at line 276 of file intrusive_list.h.

void insert_link ( link_type *  previous,
link_type *  new_link 
) [protected, inherited]

Insert a link.

Definition at line 286 of file intrusive_list.h.

bool is_trivial_list (  ) const [protected, inherited]

Is the intrusive_list a trivial length?

Definition at line 248 of file intrusive_list.h.

void merge ( list_type other )

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

Definition at line 1010 of file intrusive_list.h.

void merge ( list_type other,
TCompare  compare 
)

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

Definition at line 1019 of file intrusive_list.h.

void pop_back (  ) [inherited]

Removes a value from the back of the intrusive_list.

Definition at line 184 of file intrusive_list.h.

void pop_front (  ) [inherited]

Removes a value from the front of the intrusive_list.

Definition at line 165 of file intrusive_list.h.

void push_back ( link_type &  value ) [inherited]

Pushes a value to the back of the intrusive_list.

Definition at line 176 of file intrusive_list.h.

void push_front ( link_type &  value ) [inherited]

Pushes a value to the front of the intrusive_list.

Definition at line 157 of file intrusive_list.h.

void remove_if ( TPredicate  predicate )

Removes according to a predicate.

Definition at line 917 of file intrusive_list.h.

void remove_link ( link_type *  link ) [protected, inherited]

Remove a link.

Definition at line 305 of file intrusive_list.h.

void remove_link ( link_type &  link ) [protected, inherited]

Remove a link.

Definition at line 296 of file intrusive_list.h.

void reverse (  ) [inherited]

Reverses the list.

Definition at line 203 of file intrusive_list.h.

size_t size (  ) const [inherited]

Returns the number of elements.

Definition at line 233 of file intrusive_list.h.

void sort ( TCompare  compare )

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 786 of file intrusive_list.h.

void sort (  )

Sort using in-place merge sort algorithm.

Definition at line 775 of file intrusive_list.h.

void splice ( iterator  position,
list_type other 
)

Splice another list into this one.

Definition at line 937 of file intrusive_list.h.

void splice ( iterator  position,
list_type other,
iterator  begin_,
iterator  end_ 
)

Splice a range of elements from another list into this one.

Definition at line 983 of file intrusive_list.h.

void splice ( iterator  position,
list_type other,
iterator  isource 
)

Splice an element from another list into this one.

Definition at line 966 of file intrusive_list.h.

void unique ( TIsEqual  isEqual )

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

Definition at line 747 of file intrusive_list.h.


Field Documentation

size_t current_size [protected, inherited]

Counts the number of elements in the list.

Definition at line 243 of file intrusive_list.h.

link_type terminal_link [protected, inherited]

The link that acts as the intrusive_list start & end.

Definition at line 241 of file intrusive_list.h.