I have a class template, call it A , which has the abc() member function:
template <typename T> class A{ public: T value; void abc(); };
I can implement the abc() member function outside the class declaration using the following syntax:
template <typename T> void A<T>::abc() { value++; }
What I want to do is create a template specialization for this class, say int .
template <> class A<int>{ public: int value; void abc(); };
Question: what is the correct syntax for implementing abc() for a specialized class?
I tried using the following syntax:
template <> void A<int>::abc() { value += 2; }
However, this does not compile.
source share