Hi, all
I am writing an overloading operator >> function for a template class
and can't make it right. G++ 3.2 (Redhat8.0) gives the following
errors:
g++ -c list.cxx
In file included from SLinkList.cxx:3,
from list.cxx:1:
SLinkList.h:20: ISO C++ forbids declaration of `type name' with no
type
SLinkList.h:20: friend declaration requires class-key, i.e. `friend
int'
SLinkList.h:20: parse error before `template'
make: ***[list.o] Error 1
Here is the relevant code segments:
// declaration in SLinkList.h
template <class Type>
class SLinkList {
friend template <class Type>
istream& operator>>( istream&, SLinkList<Type>& );
...
};
// definition in SLinkList.cxx
template <class ElemType>
istream& operator>>( istream &is, SLinkList<ElemType> &slist )
{
...
}
Any help appreciated!
Leonard
3/4/2004