-1
template<> 
class A<char> { // Error here
public:
    A(char c)
    {
        // Do something here.
    }
};

When I hover on A, it says "A is not a template".

Brian
  • 21
  • 3

1 Answers1

6

You need to declare the template before you can specialize it:

// declare the template
template <typename T>   // no need to define it
struct A;               // if you only want the specialization

// declare and define the specialization
template<> 
struct A<char> {};
463035818_is_not_an_ai
  • 109,796
  • 11
  • 89
  • 185