Problems with pointer and templates
kd@flaga.is
kd@flaga.is
Wed Dec 22 01:46:00 GMT 1999
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 ¶m) {}
};
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
More information about the Gcc-help
mailing list