/* read() fills a vector with input from a stream. Receives: type parameter T, for which >> is defined an istream and a vector Input: a sequence of T values Passes back: the modified istream and vector ---------------------------------------------------------------*/ template void read(istream & in, vector & theVector) { T inputValue; for (;;) { in >> inputValue; if ( in.eof() ) break; theVector.push_back(inputValue); } } /* display() outputs a vector to a stream. Receives: type parameter T, for which << is defined an ostream and a vector Output: each T value stored in theVector to ostream out Passes back: the modified ostream ---------------------------------------------------------------*/ template void display(ostream & out, const vector & theVector) { for (int i = 0; i < theVector.size(); i++) out << theVector[i] << ' '; }