This is the mail archive of the gcc-help@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]

Re: Problems with pointer and templates



Hi,

This is a template class so you must instantiate it with a template
argument.

Something like

new Cont<Mytemplateargument>();

should work.

K.D.


                                                                                                                                    
                    Pascal Francq                                                                                                   
                    <pfrancq@ulb.ac.        To:     help-gcc@gnu.org                                                                
                    be>                     cc:                                                                                     
                    Sent by:                Subject:     Problems with pointer and templates                                        
                    gcc-help-owner@g                                                                                                
                    cc.gnu.org                                                                                                      
                                                                                                                                    
                                                                                                                                    
                    12/21/99 03:34                                                                                                  
                    PM                                                                                                              
                                                                                                                                    
                                                                                                                                    




I have a template class with a template function declare like:

template<class C> class Cont
{
public:
    Cont(void) {}
    template<class G> DoSomething(const G &param) {}
};

I declare a pointer to Cont:

Cont *ptr=new Cont();

When i try the following instruction, gcc gives me an error ("parse error
before '>')

ptr->DoSomething<int>(3);

Note: When I compile this code with a compiler like the one of borland,
there are no problems.

--


Ir. Pascal Francq
Researcher
Université Libre de Bruxelles
Faculty of Applied Mechanics
Avenue F.D. Roosevelt, 50
CP 165/41
B-1050 Brussels
BELGIUM
Tel. +32-2-650 47 65
Fax +32-2-650 27 10






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