This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Help me ,nested template!!!!!!!!!!!!!!!


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?
 
 
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]