www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.ide
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript
electronics



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