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

#include <SimpleList.h>

Public Member Functions

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

Detailed Description

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

Definition at line 213 of file SimpleList.h.

Constructor & Destructor Documentation

◆ iterator() [1/2]

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

Construct a new iterator object.

Definition at line 221 of file SimpleList.h.

221 : current(nullptr) {}

◆ iterator() [2/2]

template<typename T >
SimpleList< T >::iterator::iterator ( Node *  node)
inline

Construct a new iterator object.

Parameters
nodePointer to the starting node

Definition at line 228 of file SimpleList.h.

228 : current(node) {}

Member Function Documentation

◆ operator!=()

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

Inequality comparison operator.

Parameters
otherAnother iterator to compare with
Returns
true if the iterators are not equal, false otherwise

Definition at line 257 of file SimpleList.h.

257 { return current != other.current; }

◆ operator*()

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

Dereference operator.

Returns
T& Reference to the data in the current node

Definition at line 235 of file SimpleList.h.

235 { return current->data; }

◆ operator++()

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

Prefix increment operator.

Returns
iterator& Reference to the incremented iterator

Definition at line 249 of file SimpleList.h.

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

◆ operator->()

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

Arrow operator.

Returns
T* Pointer to the data in the current node

Definition at line 242 of file SimpleList.h.

242 { return &current->data; }

◆ operator==()

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

Equality comparison operator.

Parameters
otherAnother iterator to compare with
Returns
true if the iterators are equal, false otherwise

Definition at line 265 of file SimpleList.h.

265 { return current == other.current; }

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