public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Problems with pointer and templates
@ 1999-12-21 17:20 Pascal Francq
  1999-12-31 22:24 ` Pascal Francq
  0 siblings, 1 reply; 4+ messages in thread
From: Pascal Francq @ 1999-12-21 17:20 UTC (permalink / raw)
  To: help-gcc

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 659 bytes --]

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
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Problems with pointer and templates
  1999-12-21 17:20 Problems with pointer and templates Pascal Francq
@ 1999-12-31 22:24 ` Pascal Francq
  0 siblings, 0 replies; 4+ messages in thread
From: Pascal Francq @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 659 bytes --]

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
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Problems with pointer and templates
  1999-12-22  1:46 kd
@ 1999-12-31 22:24 ` kd
  0 siblings, 0 replies; 4+ messages in thread
From: kd @ 1999-12-31 22:24 UTC (permalink / raw)
  To: Pascal Francq; +Cc: help-gcc

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2547 bytes --]

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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Problems with pointer and templates
@ 1999-12-22  1:46 kd
  1999-12-31 22:24 ` kd
  0 siblings, 1 reply; 4+ messages in thread
From: kd @ 1999-12-22  1:46 UTC (permalink / raw)
  To: Pascal Francq; +Cc: help-gcc

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2547 bytes --]

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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-12-31 22:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-21 17:20 Problems with pointer and templates Pascal Francq
1999-12-31 22:24 ` Pascal Francq
1999-12-22  1:46 kd
1999-12-31 22:24 ` kd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).