distortos  v0.4.0
object-oriented C++ RTOS for microcontrollers
estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U > Class Template Reference

SortedIntrusiveForwardList class is an IntrusiveForwardList with sorted elements. More...

#include <SortedIntrusiveForwardList.hpp>

Collaboration diagram for estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >:
[legend]

Classes

struct  Implementation
 Implementation struct is used primarily for "Empty Base Optimization" with Compare type. More...
 

Public Types

using UnsortedIntrusiveForwardList = IntrusiveForwardList< T, NodePointer, U >
 unsorted intrusive forward list used internally More...
 
using const_iterator = typename UnsortedIntrusiveForwardList::const_iterator
 const iterator of elements on the list More...
 
using const_pointer = typename UnsortedIntrusiveForwardList::const_pointer
 const pointer to value linked in the list More...
 
using const_reference = typename UnsortedIntrusiveForwardList::const_reference
 const reference to value linked in the list More...
 
using iterator = typename UnsortedIntrusiveForwardList::iterator
 iterator of elements on the list More...
 
using pointer = typename UnsortedIntrusiveForwardList::pointer
 pointer to value linked in the list More...
 
using reference = typename UnsortedIntrusiveForwardList::reference
 reference to value linked in the list More...
 
using value_type = typename UnsortedIntrusiveForwardList::value_type
 value linked in the list More...
 

Public Member Functions

constexpr SortedIntrusiveForwardList (const Compare &compare=Compare{})
 SortedIntrusiveForwardList's constructor. More...
 
iterator before_begin ()
 
const_iterator before_begin () const
 
iterator begin ()
 
const_iterator begin () const
 
const_iterator cbefore_begin () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
void clear ()
 Unlinks all elements from the list. More...
 
bool empty () const
 
iterator end ()
 
const_iterator end () const
 
reference front ()
 
const_reference front () const
 
iterator insert (reference newElement)
 Links the element in the list, keeping it sorted. More...
 
void pop_front ()
 Unlinks the first element from the list. More...
 
void splice_after (const iterator beforeSplicedElement)
 Transfers the element from another list to this one, keeping it sorted. More...
 
void swap (SortedIntrusiveForwardList &other)
 Swaps contents with another list. More...
 
 SortedIntrusiveForwardList (const SortedIntrusiveForwardList &)=delete
 
 SortedIntrusiveForwardList (SortedIntrusiveForwardList &&)=default
 
const SortedIntrusiveForwardListoperator= (const SortedIntrusiveForwardList &)=delete
 
SortedIntrusiveForwardListoperator= (SortedIntrusiveForwardList &&)=delete
 

Static Public Member Functions

static iterator erase_after (const iterator position)
 Unlinks the element following position from the list. More...
 

Private Attributes

Implementation implementation_
 internal Implementation object - unsorted IntrusiveForwardList and Compare instance More...
 

Detailed Description

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
class estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >

SortedIntrusiveForwardList class is an IntrusiveForwardList with sorted elements.

This class tries to provide an interface similar to std::forward_list.

Note
The elements are sorted as long as the user does not modify the contents.
Template Parameters
Compareis a type of functor used for comparison, std::less results in descending order, std::greater - in ascending order
Tis the type that has the IntrusiveForwardListNode variable
NodePointeris a pointer-to-member to IntrusiveForwardListNode variable in T
Uis the type that will be stored on the list; it can be different from T, but must be implicitly convertible to T (so usually a type derived from T); default - T; using different type than T can be used to break circular dependencies, because T must be fully defined to instantiate this class, but it is enough to forward declare U - it only needs to be fully defined to use member functions

Member Typedef Documentation

◆ const_iterator

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
using estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::const_iterator = typename UnsortedIntrusiveForwardList::const_iterator

const iterator of elements on the list

◆ const_pointer

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
using estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::const_pointer = typename UnsortedIntrusiveForwardList::const_pointer

const pointer to value linked in the list

◆ const_reference

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
using estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::const_reference = typename UnsortedIntrusiveForwardList::const_reference

const reference to value linked in the list

◆ iterator

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
using estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::iterator = typename UnsortedIntrusiveForwardList::iterator

iterator of elements on the list

◆ pointer

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
using estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::pointer = typename UnsortedIntrusiveForwardList::pointer

pointer to value linked in the list

◆ reference

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
using estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::reference = typename UnsortedIntrusiveForwardList::reference

reference to value linked in the list

◆ UnsortedIntrusiveForwardList

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
using estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::UnsortedIntrusiveForwardList = IntrusiveForwardList<T, NodePointer, U>

unsorted intrusive forward list used internally

◆ value_type

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
using estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::value_type = typename UnsortedIntrusiveForwardList::value_type

value linked in the list

Constructor & Destructor Documentation

◆ SortedIntrusiveForwardList()

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
constexpr estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::SortedIntrusiveForwardList ( const Compare &  compare = Compare{})
inline

SortedIntrusiveForwardList's constructor.

Parameters
[in]compareis a reference to Compare object used to copy-construct internal comparison functor
Here is the caller graph for this function:

Member Function Documentation

◆ before_begin() [1/2]

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
iterator estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::before_begin ( )
inline
Returns
iterator of "one before the first" element on the list
Here is the caller graph for this function:

◆ before_begin() [2/2]

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
const_iterator estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::before_begin ( ) const
inline
Returns
const iterator of "one before the first" element on the list

◆ begin() [1/2]

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
iterator estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::begin ( )
inline
Returns
iterator of first element on the list

◆ begin() [2/2]

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
const_iterator estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::begin ( ) const
inline
Returns
const iterator of first element on the list

◆ cbefore_begin()

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
const_iterator estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::cbefore_begin ( ) const
inline
Returns
const iterator of "one before the first" element on the list

◆ cbegin()

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
const_iterator estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::cbegin ( ) const
inline
Returns
const iterator of first element on the list

◆ cend()

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
const_iterator estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::cend ( ) const
inline
Returns
const iterator of "one past the last" element on the list

◆ clear()

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
void estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::clear ( )
inline

Unlinks all elements from the list.

◆ empty()

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
bool estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::empty ( ) const
inline
Returns
true is the list is empty, false otherwise

◆ end() [1/2]

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
iterator estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::end ( )
inline
Returns
iterator of "one past the last" element on the list
Here is the caller graph for this function:

◆ end() [2/2]

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
const_iterator estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::end ( ) const
inline
Returns
const iterator of "one past the last" element on the list

◆ erase_after()

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
static iterator estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::erase_after ( const iterator  position)
inlinestatic

Unlinks the element following position from the list.

Note
No instance of the list is needed for this operation.
Parameters
[in]positionis an iterator preceding the element which will be unlinked from the list
Returns
iterator of the element that was following the element which was unlinked

◆ front() [1/2]

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
reference estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::front ( )
inline
Returns
reference to first element on the list
Here is the caller graph for this function:

◆ front() [2/2]

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
const_reference estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::front ( ) const
inline
Returns
const reference to first element on the list

◆ insert()

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
iterator estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::insert ( reference  newElement)
inline

Links the element in the list, keeping it sorted.

Parameters
[in]newElementis a reference to the element that will be linked in the list
Returns
iterator of newElement

◆ pop_front()

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
void estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::pop_front ( )
inline

Unlinks the first element from the list.

◆ splice_after()

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
void estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::splice_after ( const iterator  beforeSplicedElement)
inline

Transfers the element from another list to this one, keeping it sorted.

Parameters
[in]beforeSplicedElementis an iterator of the element preceding the one which will be spliced from another list to this one
Here is the caller graph for this function:

◆ swap()

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
void estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::swap ( SortedIntrusiveForwardList< Compare, T, NodePointer, U > &  other)
inline

Swaps contents with another list.

Parameters
[in]otheris a reference to SortedIntrusiveForwardList with which contents of this list will be swapped
Here is the caller graph for this function:

Member Data Documentation

◆ implementation_

template<typename Compare, typename T, IntrusiveForwardListNode T::* NodePointer, typename U = T>
Implementation estd::SortedIntrusiveForwardList< Compare, T, NodePointer, U >::implementation_
private

internal Implementation object - unsorted IntrusiveForwardList and Compare instance


The documentation for this class was generated from the following file: