> >I am using VC++ 6 (sp6) and cannot change compilers. I have something
> > akin to this code:
[quoted text clipped - 38 lines]
> For VC6? No, not really (not that I've seen anyway). The parser simply
> doesn't understand explicit template arguments on a function invocation.
>> For VC6? No, not really (not that I've seen anyway). The parser simply
>> doesn't understand explicit template arguments on a function invocation.
>
> Except for free-standing functions, of course. Thanks for responding!
Right - the member function template support is extremely patchy. And
for free standing functions, you have to make sure that T is present
somewhere in the function signature in any case (e.g.
template <class T>
void f(T* t = 0); //default parameter to make sure VC6 doesn't
//collapse all instantiations into one.
//f<int>() should work though, IIRC.
Any reason why you're using an 8 year old compiler? That would be like
still using egcs rather than GCC!
Tom
mlimber - 25 Aug 2006 14:40 GMT
> Any reason why you're using an 8 year old compiler? That would be like
> still using egcs rather than GCC!
Because I'm working with legacy code, and the management wants to avoid
surprises. Me, I like surprises. :-)
Cheers! --M
Bo Persson - 25 Aug 2006 16:28 GMT
>> Any reason why you're using an 8 year old compiler? That would be
>> like
[quoted text clipped - 5 lines]
>
> Cheers! --M
And the fact that it doesn't work is no surprise. Then what? :-)
Bo Persson
Bo Persson - 25 Aug 2006 16:34 GMT
>>> For VC6? No, not really (not that I've seen anyway). The parser
>>> simply
[quoted text clipped - 3 lines]
>> Except for free-standing functions, of course. Thanks for
>> responding!
It just looks that way, until you try to use several different
instantiations!
> Right - the member function template support is extremely patchy.
> And for free standing functions, you have to make sure that T is
[quoted text clipped - 3 lines]
> //collapse all instantiations into one.
> //f<int>() should work though, IIRC.
The compiler actually works (almost :-) correctly for the free
functions, in that it produces one set of code for each instantiation.
Unfortunately they all have the same signature,
void-f-with-no-parameters.
Then, of course, the linker can't tell them apart so we don't know
which one we get.
> Any reason why you're using an 8 year old compiler? That would be
> like still using egcs rather than GCC!
Right.
"To avoid surprises". :-)
Bo Persson