I have a code snippet given by my instructor in data structures.
when I compile, I get these errors:Code:template<class T> void myDataStruct<T>::output(ostream& out) const {// Put the list into the stream out. copy(element, element + listSize, ostream_iterator<T>(cout, " ")); } // operator overload << template <class T> ostream& operator<<(ostream& out, const myDataStruct<T>& x) {x.output(out); return out;}
myDataStruct.h: In member function ‘T& myDataStruct<T>::get(int) const’:
myDataStruct.h:77: error: expected primary-expression before ‘&’ token
myDataStruct.h: In member function ‘void myDataStruct<T>:utput(std:stream&) const’:
myDataStruct.h:138: error: ‘ostream_iterator’ was not declared in this scope
myDataStruct.h:138: error: expected primary-expression before ‘>’ token
I don't get what's going on... this should work "out of the box" sortof speak... at least i'd expect that form my porfessor.