Lab 7 - Template Classes

The purpose of this lab is to convert the DoubleList class from Lab 5 to a template class called GenericList.

Copy your solution or my solution to a file called lab7.cpp. First alter the class so it is now called GenericList instead of DoubleList. Then convert the class to a template class. Do not use seperate compilation as Helios does not support seperate compilation for template classes well.

NOTE: On the version of g++ on Helios (3.4.5), you must jump through several hoops to get the friend functions of a template class working. What is listed in the book will not compile. Here is the code that you will need to add ABOVE your class definition for the output and concatenation operators to work:

template <class T> class GenericList;

template <class T>
ostream & operator <<(ostream &o, const GenericList<T> &right);

template <class T>
GenericList<T> operator +(const GenericList<T> &left, const GenericList<T> &right);
Additionally, within your class definition you must add <> in the friend declarations as follows:
friend ostream & operator << <>(ostream &o, const GenericList<T> &right);
friend GenericList<T> operator + <>(const GenericList<T> &left,
				const GenericList<T> &right);
Use this main program to test your code. Since Helios does not well support seperate compilation for template classes, just cut and paste this file into the bottom of your lab7.cpp file.