1

Whilst looking through some code I have found the following syntax:

template<class X>
class A
{
public:
    template <typename Z>
    void func()
    {
        Z as;
        as++; 
    }
};

void f()
{
   A<int> obj;
   obj.template func<int>();
}

Is there any reason or good practice for obj.template func<int>() ? I would usually just go for obj.func<int>() Is this some new syntax in c++11/14/17/20?

Thank you!

eucristian
  • 391
  • 3
  • 17
  • Thank you very much. yes the question is answered in the suggested link. sorry I didn't find it before asking. – eucristian Oct 22 '20 at 10:19

0 Answers0