Search code examples
c++parsingtemplatesparse-error

C++ template parse error


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

I have a static template method test in class A which takes a single bool template parameter. When I try to call the function like this:

x = A::test<true>(...);

The parser complains as it treats the < as the less than operator. How can I tell the compiler that this is a template instanciation rather than a less than oprator?


Solution

  • A::template test<true>(...);
    

    read Where and why do I have to put the "template" and "typename" keywords?