Source of inorder.cpp


  1: //  Created by Frank M. Carrano and Timothy M. Henry.
  2: //  Copyright (c) 2017 Pearson Education, Hoboken, New Jersey.

  4: template<class ItemType>
  5: void BinaryNodeTree<ItemType>::
  6:      inorder(void visit(ItemType&),
  7:              std::shared_ptr<BinaryNode<ItemType>> treePtr) const
  8: {
  9:    if (treePtr != nullptr)
 10:    {
 11:       inorder(visit, treePtr–>getLeftChildPtr());
 12:       ItemType theItem = treePtr–>getItem();
 13:       visit(theItem);
 14:       inorder(visit, treePtr–>getRightChildPtr());
 15:    }  // end if
 16: }  // end inorder