www.digitalmars.com         C & C++   DMDScript  

c++ - template operator<<

Hi,
I have such a problem :
In template class I define <<operator(h file):
template <class T> friend ostream& operator<< (ostream& out, const
container<T>& c);
The impementation in cpp file
template <class T>
ostream& operator<< (ostream& out, const container<T>& c)
{
	elem<T> *Iter = c.head;
	while(Iter != NULL)
	{
		out<<Iter->mData<<" ";
		Iter = Iter -> next;
	}
	out<<endl;
	return out;
}
and  get the error:
C:\C\Studies\C++\Container\container.cpp(110) : error
C2562: '<<' : 'void' function returning a value

Thak You
Feb 22 2008