Re: Need help with templates and VC6
- From: "Carl Daniel [VC++ MVP]" <cpdaniel_remove_this_and_nospam@xxxxxxxxxxxxxxx>
- Date: Thu, 5 Jun 2008 06:46:31 -0700
Alex Blekhman wrote:
"Daniel Lidström" wrote:
...The support of member templates in VC6 is rather basic. In order
to compile the above code you must make the `Add' member to accept
a parameter of type `T'. Otherwise VC6 is unable to deduce correct
type of the member. Example:
class Dep
{
public:
template<class T>
void Add(T* dummy = NULL)
{}
};
int main()
{
Dep dep;
dep.Add<int>();
Should be
dep.Add((int*)0);
VC6 and eVC4 are not able to correctly parse the explicit template arguments
at a function callsite - they'll always indicate a syntax error. Instead,
you have to add a parameter (as Alex said) and pass it at the call site so
that template argument deduction can kick in.
Better still, upgrade (although that might not be possible if you're stuck
with eVC4).
return 0;
}
HTH
Alex
-cd
.
- Follow-Ups:
- Re: Need help with templates and VC6
- From: Alex Blekhman
- Re: Need help with templates and VC6
- From: Daniel Lidström
- Re: Need help with templates and VC6
- References:
- Need help with templates and VC6
- From: Daniel Lidström
- Re: Need help with templates and VC6
- From: Alex Blekhman
- Need help with templates and VC6
- Prev by Date: Re: Need help with templates and VC6
- Next by Date: Re: Need help with templates and VC6
- Previous by thread: Re: Need help with templates and VC6
- Next by thread: Re: Need help with templates and VC6
- Index(es):
Relevant Pages
|