0

I am writing a class that has template specialization by value and was wondering if the Constructor and the methods in the template specialization also need to have < VALUE > in their declaration.

In other words, which of the following two examples are correct?

A)

template <int i>
class MyClass {};

template <>
class MyClass<0> {
  public: 
    MyClass<0>() {         // specialization value included
      // initialize stuff
    }
    void PrintClass<0> () {     // specialization value included
      // print stuff 
    }
 }

B)

template <int i>
class MyClass {};

template <>
class MyClass<0> {
  public: 
    MyClass() {            // specialization value NOT included
      // initialize stuff
    }
    void PrintClass () {        // specialization value NOT included
      // print stuff 
    }
 }
raovgarimella
  • 166
  • 1
  • 8

0 Answers0