TaskSched
Public Member Functions | List of all members
SimpleList< T >::const_iterator Class Reference

Iterator class for SimpleList. More...

#include <SimpleList.h>

Public Member Functions

 const_iterator ()
 Construct a new const_iterator object. More...
 
 const_iterator (const Node *node)
 Construct a new const_iterator object. More...
 
const T & operator* () const
 Dereference operator. More...
 
const T * operator-> () const
 Arrow operator. More...
 
const_iteratoroperator++ ()
 Prefix increment operator. More...
 
const_iterator operator++ (int)
 Postfix increment operator. More...
 
bool operator!= (const const_iterator &other) const
 Inequality comparison operator. More...
 
bool operator== (const const_iterator &other) const
 Equality comparison operator. More...
 

Detailed Description

template<typename T>
class SimpleList< T >::const_iterator

Iterator class for SimpleList.

Definition at line 137 of file SimpleList.h.

Constructor & Destructor Documentation

◆ const_iterator() [1/2]

template<typename T >
SimpleList< T >::const_iterator::const_iterator ( )
inline

Construct a new const_iterator object.

Definition at line 145 of file SimpleList.h.

145 : current(nullptr) {}

◆ const_iterator() [2/2]

template<typename T >
SimpleList< T >::const_iterator::const_iterator ( const Node *  node)
inlineexplicit

Construct a new const_iterator object.

Parameters
nodePointer to the starting node

Definition at line 152 of file SimpleList.h.

152 : current(node) {}

Member Function Documentation

◆ operator!=()

template<typename T >
bool SimpleList< T >::const_iterator::operator!= ( const const_iterator other) const
inline

Inequality comparison operator.

Parameters
otherAnother const_iterator to compare with
Returns
true if the const_iterators are not equal, false otherwise

Definition at line 188 of file SimpleList.h.

188 { return current != other.current; }

◆ operator*()

template<typename T >
const T& SimpleList< T >::const_iterator::operator* ( ) const
inline

Dereference operator.

Returns
const T& Const reference to the data in the current node

Definition at line 159 of file SimpleList.h.

159 { return current->data; }

◆ operator++() [1/2]

template<typename T >
const_iterator& SimpleList< T >::const_iterator::operator++ ( )
inline

Prefix increment operator.

Returns
const_iterator& Reference to the incremented const_iterator

Definition at line 173 of file SimpleList.h.

173 { if (current) current = current->next; return *this; }

◆ operator++() [2/2]

template<typename T >
const_iterator SimpleList< T >::const_iterator::operator++ ( int  )
inline

Postfix increment operator.

Returns
const_iterator Copy of the original iterator

Definition at line 180 of file SimpleList.h.

180 { const_iterator tmp = *this; ++(*this); return tmp; }
const_iterator()
Construct a new const_iterator object.
Definition: SimpleList.h:145

◆ operator->()

template<typename T >
const T* SimpleList< T >::const_iterator::operator-> ( ) const
inline

Arrow operator.

Returns
const T* Const pointer to the data in the current node

Definition at line 166 of file SimpleList.h.

166 { return &current->data; }

◆ operator==()

template<typename T >
bool SimpleList< T >::const_iterator::operator== ( const const_iterator other) const
inline

Equality comparison operator.

Parameters
otherAnother const_iterator to compare with
Returns
true if the const_iterators are equal, false otherwise

Definition at line 196 of file SimpleList.h.

196 { return current == other.current; }

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