Re: Need help with templates and VC6

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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


.



Relevant Pages

  • Re: Create Group Member
    ... Your question sounds there are other templates other than the .eml template. ... Now you will have an envelope icon on your Desktop that when you click on it, you will have a New Message window with your saved opening & member list ready to go. ... I would suggest putting your email address in the To line to keep the Undisclosed Recipients from showing instead which may be filtered upon. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: pushing the limits of use-before-declaration within a class
    ... > methods or multiple inheritence. ... going to be used again other than being the type of the member c. ... I have a class template that inherits from a class that is a template ... This base class tells the templated class where an array ...
    (comp.lang.cpp)
  • Re: c to c++
    ... to form, they refused to fix), long replaced. ... MS still gets grief for the template support in VC6 (despite being ... a compiler option to do it either way). ...
    (comp.lang.c)
  • Re: Problem with inheritance and tamplates
    ... your code is a template argument dependant name, ... of a base class that is dependent on a template argument. ... You need to tell the compiler it is a member name, ...
    (comp.lang.cpp)
  • Re: Templates and static functions
    ... >This last line fail in the compilation, ... Is there any trick to make it work in VC6? ... VC6 doesn't support defining member templates outside the class body. ... Function templates that have a template parameter that isn't represented ...
    (microsoft.public.vc.mfc)