lab_trees
Tempestuous Trees
TreeTraversal< T >::Iterator Class Reference

A forward iterator class through an TreeTravesal, derived from the std iterator class. More...

#include <TreeTraversal.h>

Inheritance diagram for TreeTraversal< T >::Iterator:
[legend]
Collaboration diagram for TreeTraversal< T >::Iterator:
[legend]

Public Member Functions

 Iterator ()
 Default constructor for Iterator class Sets the traversal pointer to NULL. More...
 
 Iterator (TreeTraversal< T > *traversal, typename BinaryTree< T >::Node *root)
 Two parameters constructor for Iterator class. More...
 
Iteratoroperator++ ()
 operator++ for Iterator class More...
 
BinaryTree< T >::Node * operator * ()
 Iterator access opreator. More...
 
bool operator!= (const Iterator &other)
 Iterator inequality operator. More...
 

Private Attributes

TreeTraversaltraversal
 
BinaryTree< T >::Node * root
 
BinaryTree< T >::Node * current
 

Detailed Description

template<typename T>
class TreeTraversal< T >::Iterator

A forward iterator class through an TreeTravesal, derived from the std iterator class.

Constructor & Destructor Documentation

◆ Iterator() [1/2]

template<typename T >
TreeTraversal< T >::Iterator::Iterator ( )
inline

Default constructor for Iterator class Sets the traversal pointer to NULL.

◆ Iterator() [2/2]

template<typename T >
TreeTraversal< T >::Iterator::Iterator ( TreeTraversal< T > *  traversal,
typename BinaryTree< T >::Node *  root 
)
inline

Two parameters constructor for Iterator class.

Parameters
traversalThe traversal reference passed in
rootThe root of the tree to be traversed

initialize the current iterator to top Node of the stack

Member Function Documentation

◆ operator *()

template<typename T >
BinaryTree<T>::Node* TreeTraversal< T >::Iterator::operator * ( )
inline

Iterator access opreator.

Returns
the current Node in the TreeTraversal.

◆ operator!=()

template<typename T >
bool TreeTraversal< T >::Iterator::operator!= ( const Iterator other)
inline

Iterator inequality operator.

Returns
if two iterators are not equal.

◆ operator++()

template<typename T >
Iterator& TreeTraversal< T >::Iterator::operator++ ( )
inline

operator++ for Iterator class

Returns
the current Node in the traversal

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