Code Fragment: EulerTour2



template <typename BinaryTree>				// do the tour
int EulerTour<BinaryTree>::eulerTour(const Position& v) const {
  TraversalResult r = initResult();
  if (tree->isExternal(v)) {				// external node
    visitExternal(v, r);
  }
  else {						// internal node
    visitLeft(v, r);
    r.leftResult = eulerTour(tree->leftChild(v));	// recursive on left
    visitBelow(v, r);
    r.rightResult = eulerTour(tree->rightChild(v));	// recursive on right
    visitRight(v, r);
  }
  return result(r);
}