Help me ,nested template!!!!!!!!!!!!!!!
lau freeman
laufreeman@hotmail.com
Fri Apr 14 06:09:00 GMT 2000
I defined a template class Poly in poly.h template
<class T,class S> class
Poly{ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ
. ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ
. ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ
. ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ . //and a friend function
ÃÂ
friend Poly<T,S>ÃÂ operator* <>(const T
&c,const Poly<T,S> &pl) ; };
ÃÂ
Then I want to define another class:
ÃÂ
typedef class Poly<double,double>ÃÂ
sPoly;
ÃÂ
class biPoly : public Poly<sPoly,double> {
ÃÂ
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ
. ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ
. ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ
. ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ . }
ÃÂ
I used g++2.952 , after compiling, a error appeared like
this: ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ
In instantiation of
`Polynomial<double,double>': bipoly.h:5:ÃÂ ÃÂ instantiated from
here poly.h:97: invalid use of undefined type `class
Poly<double,double>' poly.h:22: forward declaration of `class
Poly<double,double>' poly.h:97: confused by earlier errors, bailing
out then I defined template class Poly<double,double>;
ÃÂ
but a error like this appeared : invalid use of
undefined type :Poly<Poly<double,double>,double>
ÃÂ
but I used g++2.905 and succeeded,what should I
do?
ÃÂ
ÃÂ
ÃÂ
More information about the Gcc-bugs
mailing list