3

Possible Duplicate:
Where and why do I have to put the “template” and “typename” keywords?

I recently encountered the following C++ syntax:

int a = MyObj.template MyMethod<MyType>();

Is there a name for this sort of syntax? Where can I read more about when it is required?

This is opposed to the usual syntax which is just

int a = MyObj.MyMethod<MyType>();

The first syntax form seems to be required in some cases where the called method has both template and non-template overloads; the regular form of just calling the function gave an error in the code I compiled with clang.

Community
  • 1
  • 1
Danra
  • 9,546
  • 5
  • 59
  • 117

0 Answers0