DSA - Data Structures and Algorithms
Loading...
Searching...
No Matches
dsa::ForwardList< T >::Node Class Reference

Implements Node class with user data. More...

#include <forward_list.h>

Inheritance diagram for dsa::ForwardList< T >::Node:
dsa::ForwardList< T >::NodeBase

Public Member Functions

 Node (const T &value)
 Construct a new Node object with initial value.
 Node (T &&value)
 Construct a new Node object with initial value using move semantics.
auto value () -> T &
 Function returns value stored in Node object.
auto value () const -> T
 Function returns value stored in Node object.
Public Member Functions inherited from dsa::ForwardList< T >::NodeBase
 NodeBase ()=default
 Construct a new NodeBase object.
 NodeBase (const NodeBase &other)=default
 Construct a new NodeBase object using copy constructor.
auto operator= (const NodeBase &other) -> NodeBase &=default
 Construct a new NodeBase object using copy assignment.
 NodeBase (NodeBase &&other)=default
 Construct NodeBase object using move constructor.
auto operator= (NodeBase &&other) -> NodeBase &=default
 Construct NodeBase object using move assignment.
virtual ~NodeBase ()=default
 Destroy the Node Base object.

Friends

class ForwardList
 Forward friend declaration of ForwardList.

Detailed Description

template<typename T>
class dsa::ForwardList< T >::Node

Implements Node class with user data.

Definition at line 104 of file forward_list.h.

Constructor & Destructor Documentation

◆ Node() [1/2]

template<typename T>
dsa::ForwardList< T >::Node::Node ( const T & value)
inline

Construct a new Node object with initial value.

Parameters
[in]valueto store in Node object

Definition at line 113 of file forward_list.h.

114 : m_value{ value }
115 {}
auto value() -> T &
Function returns value stored in Node object.

◆ Node() [2/2]

template<typename T>
dsa::ForwardList< T >::Node::Node ( T && value)
inline

Construct a new Node object with initial value using move semantics.

value will be taken by constructed object

Parameters
[in]valueto store in Node object

Definition at line 123 of file forward_list.h.

124 : m_value{ std::move(value) }
125 {}
Implements ForwardList using Node with pointer to next element as internal base.

Member Function Documentation

◆ value() [1/2]

template<typename T>
auto dsa::ForwardList< T >::Node::value ( ) -> T&
inlinenodiscard

Function returns value stored in Node object.

Returns
T& reference to value stored in Node

Definition at line 132 of file forward_list.h.

133 {
134 return m_value;
135 }

◆ value() [2/2]

template<typename T>
auto dsa::ForwardList< T >::Node::value ( ) const -> T
inlinenodiscard

Function returns value stored in Node object.

Returns
T to value stored in Node

Definition at line 142 of file forward_list.h.

143 {
144 return m_value;
145 }

◆ ForwardList

template<typename T>
friend class ForwardList
friend

Forward friend declaration of ForwardList.

Definition at line 152 of file forward_list.h.


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