Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Snode< T > Class Template Reference

Singly linked node that stores data of type T. More...

#include <tpl_snode.H>

Inheritance diagram for Aleph::Snode< T >:
[legend]
Collaboration diagram for Aleph::Snode< T >:
[legend]

Public Member Functions

T & get_data ()
 Return a modifiable reference to the stored data.
 
const T & get_data () const
 Return a constant reference to the stored data.
 
constexpr Snode () noexcept(noexcept(T{}))
 Default constructor.
 
 Snode (const T &_data)
 Constructor that copies the value.
 
 Snode (T &&_data)
 Constructor that moves the value.
 
Snode * remove_next ()
 Remove the node right after this and return it.
 
Snode *& get_next ()
 Return the next node after this.
 
const Snode * get_next () const
 Return the next node after this (const overload).
 
Snode * remove_first ()
 Remove and return the first node (for symmetry with list front).
 
const Snode * get_first () const
 Return the first node (const alias of get_next).
 

Private Attributes

T data
 

Additional Inherited Members

Detailed Description

template<typename T>
class Aleph::Snode< T >

Singly linked node that stores data of type T.

Snode inherits the Slink interface and adds the payload held by the node.

Template Parameters
Ttype of the stored value
See also
DynSlist Snode Slink

Definition at line 65 of file tpl_snode.H.

Constructor & Destructor Documentation

◆ Snode() [1/3]

template<typename T >
constexpr Aleph::Snode< T >::Snode ( )
inlineconstexprnoexcept

Default constructor.

Value-initializes data (zero for a scalar or pointer T) rather than leaving it indeterminate, unlike a defaulted constructor would for such T (Coverity CID 173393). constexpr and the noexcept condition are spelled out explicitly so this hand-written constructor keeps the same conditional properties a defaulted one would have inferred from T.

Definition at line 84 of file tpl_snode.H.

◆ Snode() [2/3]

template<typename T >
Aleph::Snode< T >::Snode ( const T &  _data)
inline

Constructor that copies the value.

Definition at line 87 of file tpl_snode.H.

◆ Snode() [3/3]

template<typename T >
Aleph::Snode< T >::Snode ( T &&  _data)
inline

Constructor that moves the value.

Definition at line 90 of file tpl_snode.H.

Member Function Documentation

◆ get_data() [1/2]

template<typename T >
T & Aleph::Snode< T >::get_data ( )
inline

Return a modifiable reference to the stored data.

Definition at line 73 of file tpl_snode.H.

References Aleph::Snode< T >::data.

Referenced by Aleph::DynSlist< T >::Iterator::get_curr(), Aleph::DynSlist< T >::Iterator::get_curr(), main(), Aleph::DynSlist< T >::operator[](), TEST(), and TEST().

◆ get_data() [2/2]

template<typename T >
const T & Aleph::Snode< T >::get_data ( ) const
inline

Return a constant reference to the stored data.

Definition at line 76 of file tpl_snode.H.

References Aleph::Snode< T >::data.

◆ get_first()

template<typename T >
const Snode * Aleph::Snode< T >::get_first ( ) const
inline

Return the first node (const alias of get_next).

Definition at line 108 of file tpl_snode.H.

References Aleph::Snode< T >::get_next().

◆ get_next() [1/2]

◆ get_next() [2/2]

template<typename T >
const Snode * Aleph::Snode< T >::get_next ( ) const
inline

Return the next node after this (const overload).

Definition at line 99 of file tpl_snode.H.

References Aleph::Slink::get_next().

◆ remove_first()

template<typename T >
Snode * Aleph::Snode< T >::remove_first ( )
inline

Remove and return the first node (for symmetry with list front).

Definition at line 105 of file tpl_snode.H.

References Aleph::Snode< T >::remove_next().

Referenced by TEST().

◆ remove_next()

template<typename T >
Snode * Aleph::Snode< T >::remove_next ( )
inline

Remove the node right after this and return it.

Definition at line 93 of file tpl_snode.H.

References Aleph::Slink::remove_next().

Referenced by main(), Aleph::Slist< T >::remove_first(), Aleph::Snode< T >::remove_first(), Aleph::Slist< T >::remove_first_ne(), and TEST().

Member Data Documentation

◆ data


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