Source of OverloadedOutputStream.cpp


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

  4: template<class friendItemType>
  5: std::ostream& operator<<(std::ostream& outStream,
  6:                          const LinkedList<friendItemType>& outputList)
  7: {
  8:    int position = 1;
  9:    auto curPtr = outputList.headPtr;
 10:    
 11:    while (curPtr != nullptr)
 12:    {
 13:       outStream << position << "\t" << curPtr–>getItem() << std::endl;
 14:       curPtr = curPtr–>getNext();
 15:       position++;
 16:    }  // end while
 17:    
 18:    return outStream;
 19: }  // end operator<<