template warnings and error help, (gcc)
Posted
by sil3nt
on Stack Overflow
See other posts from Stack Overflow
or by sil3nt
Published on 2010-05-15T05:44:51Z
Indexed on
2010/05/15
5:54 UTC
Read the original article
Hit count: 241
Hi there, I'm working on an container class template (for int,bool,strings etc), and I've been stuck with this error
cont.h:56: error: expected initializer before '&' token
for this section
template <typename T>
const Container & Container<T>::operator=(const Container<T> & rightCont){
what exactly have I done wrong there?.
Also not sure what this warning message means.
cont.h:13: warning: friend declaration `bool operator==(const Container<T>&, const Container<T>&)' declares a non-template function
cont.h:13: warning: (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here) -Wno-non-template-friend disables this warning
at this position
template <typename T>
class Container{
friend bool operator==(const Container<T> &rhs,const Container<T> &lhs);
public:
© Stack Overflow or respective owner