ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
BidiListHook< TElement > Struct Template Reference

Description:

template<typename TElement>
struct alib::lang::BidiListHook< TElement >

This struct, together with sibling struct lang::BidiNodeBase provide the tools to implement a doubly linked list of TElement instances.

Template type TElement has to extend struct BidiNodeBase<TElement>.

See also
Types lang::SidiNodeBase,
lang::SidiListHook, and
lang::BidiNodeBase.
Template Parameters
TElementThe "final" custom type that (by contract) is derived from lang::BidiNodeBase.

Definition at line 135 of file bidilist.hpp.

#include <bidilist.hpp>

Public Type Index:

using TFNode = SidiNodeBase<TElement>
 An alias for the base type of the node type of this list.
 
using TNode = BidiNodeBase<TElement>
 An alias for the node type of this list.
 

Public Field Index:

TNode hook
 The root node. Points twice to itself when the list is empty.
 

Public Method Index:

 BidiListHook () noexcept
 Default constructor. Initializes this list to be empty.
 
 BidiListHook (BidiListHook &&move) noexcept
 
 BidiListHook (const BidiListHook &)=delete
 Deleted copy constructor.
 
 BidiListHook (TElement *first) noexcept
 
 BidiListHook (TElement *first, TElement *last) noexcept
 
integer count (const TNode *end=nullptr) const noexcept
 
TElement * end () const noexcept
 
TElement * first () const noexcept
 
bool isEmpty () const noexcept
 
bool isFirst (const TElement *elem) const noexcept
 
bool isLast (const TElement *elem) const noexcept
 
TElement * last () const noexcept
 
BidiListHookoperator= (BidiListHook &&) noexcept=default
 
BidiListHookoperator= (const BidiListHook &)=delete
 
TElement * popEnd () noexcept
 
TElement * popFront () noexcept
 
void pushEnd (TElement *elem) noexcept
 
void pushEnd (TElement *first, TElement *last) noexcept
 
void pushFront (TElement *elem) noexcept
 
void pushFront (TElement *first, TElement *last) noexcept
 
void reset () noexcept
 Resets this list to zero elements.
 

Type Definition Details:

◆ TFNode

template<typename TElement >
using TFNode = SidiNodeBase<TElement>

An alias for the base type of the node type of this list.

Definition at line 138 of file bidilist.hpp.

◆ TNode

template<typename TElement >
using TNode = BidiNodeBase<TElement>

An alias for the node type of this list.

Definition at line 141 of file bidilist.hpp.

Field Details:

◆ hook

template<typename TElement >
TNode hook

The root node. Points twice to itself when the list is empty.

Definition at line 144 of file bidilist.hpp.

Constructor(s) / Destructor Details:

◆ BidiListHook() [1/4]

template<typename TElement >
BidiListHook ( )
inlinenoexcept

Default constructor. Initializes this list to be empty.

Definition at line 147 of file bidilist.hpp.

Here is the call graph for this function:

◆ BidiListHook() [2/4]

template<typename TElement >
BidiListHook ( BidiListHook< TElement > && move)
inlinenoexcept

Move constructor. Takes elements of move and sets move to empty.

Parameters
moveThe list to move.

Definition at line 158 of file bidilist.hpp.

Here is the call graph for this function:

◆ BidiListHook() [3/4]

template<typename TElement >
BidiListHook ( TElement * first)
inlineexplicitnoexcept

Constructor accepting a pointer to the first element.

Parameters
firstThe element to use as the first element of this list.

Definition at line 180 of file bidilist.hpp.

Here is the call graph for this function:

◆ BidiListHook() [4/4]

template<typename TElement >
BidiListHook ( TElement * first,
TElement * last )
inlinenoexcept

Constructor accepting a pointer to the first and last element.

Parameters
firstThe element to use as the first element of this list.
lastThe element to use as the last element of this list.

Definition at line 191 of file bidilist.hpp.

Here is the call graph for this function:

Method Details:

◆ count()

template<typename TElement >
integer count ( const TNode * end = nullptr) const
inlinenodiscardnoexcept

Counts the number of elements found in the range starting with this list's first element and ending with the element before end.

Parameters
endThe element after the last one to count. Defaults to a nullptr marking the end of the list.
Returns
The number of elements in the range.

Definition at line 277 of file bidilist.hpp.

Here is the call graph for this function:

◆ end()

template<typename TElement >
TElement * end ( ) const
inlinenoexcept

Returns a pointer to the hook node cast to a pointer to a mutable element. This method must only be used in cases where such conversion is allowed i.e., with iterator types that use this pointer exclusively for pointer value comparison but do not allow (by contract) to dereference or otherwise use this pointer.

Returns
The first element of this list.

Definition at line 212 of file bidilist.hpp.

◆ first()

template<typename TElement >
TElement * first ( ) const
inlinenodiscardnoexcept

Returns the first element of this list.

Returns
The first element of this list.

Definition at line 219 of file bidilist.hpp.

Here is the call graph for this function:

◆ isEmpty()

template<typename TElement >
bool isEmpty ( ) const
inlinenodiscardnoexcept

Tests if this list is empty.

Returns
false if the list is empty, true otherwise.

Definition at line 202 of file bidilist.hpp.

Here is the call graph for this function:

◆ isFirst()

template<typename TElement >
bool isFirst ( const TElement * elem) const
inlinenodiscardnoexcept

Tests if given elem is the first element of this list.

Parameters
elemThe element to test for being the first.
Returns
true if elem is the first element of this list, false otherwise.

Definition at line 230 of file bidilist.hpp.

Here is the call graph for this function:

◆ isLast()

template<typename TElement >
bool isLast ( const TElement * elem) const
inlinenodiscardnoexcept

Tests if given elem is the last element of this list.

Parameters
elemThe element to test for being the last.
Returns
true if elem is the last element of this list, false otherwise.

Definition at line 236 of file bidilist.hpp.

Here is the call graph for this function:

◆ last()

template<typename TElement >
TElement * last ( ) const
inlinenodiscardnoexcept

Returns the last element of this list.

Returns
The last element of this list.

Definition at line 224 of file bidilist.hpp.

Here is the call graph for this function:

◆ operator=() [1/2]

template<typename TElement >
BidiListHook & operator= ( BidiListHook< TElement > && )
defaultnoexcept

Defaulted move assignment operator.

Returns
A reference to this list object.

◆ operator=() [2/2]

template<typename TElement >
BidiListHook & operator= ( const BidiListHook< TElement > & )
delete

Deleted copy assignment operator.

Returns
A reference to this list object.

◆ popEnd()

template<typename TElement >
TElement * popEnd ( )
inlinenoexcept

Removes and returns the last element from this list. Must not be invoked on empty lists.

Returns
A pointer to the last element (which was removed).

Definition at line 264 of file bidilist.hpp.

Here is the call graph for this function:

◆ popFront()

template<typename TElement >
TElement * popFront ( )
inlinenoexcept

Removes and returns the first element from this list. Must not be invoked on empty lists.

Returns
A pointer to the first element (which was removed).

Definition at line 259 of file bidilist.hpp.

Here is the call graph for this function:

◆ pushEnd() [1/2]

template<typename TElement >
void pushEnd ( TElement * elem)
inlinenoexcept

Hooks the given element to the end of this list.

Parameters
elemThe element to insert to at the start.

Definition at line 249 of file bidilist.hpp.

Here is the call graph for this function:

◆ pushEnd() [2/2]

template<typename TElement >
void pushEnd ( TElement * first,
TElement * last )
inlinenoexcept

Hooks the given range of elements to the end of this list.

Parameters
firstThe first element of the range to insert.
lastThe last element of the range to insert.

Definition at line 254 of file bidilist.hpp.

Here is the call graph for this function:

◆ pushFront() [1/2]

template<typename TElement >
void pushFront ( TElement * elem)
inlinenoexcept

Hooks the given element to the beginning of this list.

Parameters
elemThe element to insert to at the start.

Definition at line 240 of file bidilist.hpp.

Here is the call graph for this function:

◆ pushFront() [2/2]

template<typename TElement >
void pushFront ( TElement * first,
TElement * last )
inlinenoexcept

Hooks the given range of elements to the front of this list.

Parameters
firstThe first element of the range to insert.
lastThe last element of the range to insert.

Definition at line 245 of file bidilist.hpp.

Here is the call graph for this function:

◆ reset()

template<typename TElement >
void reset ( )
inlinenoexcept

Resets this list to zero elements.

Definition at line 205 of file bidilist.hpp.

Here is the call graph for this function:

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