[gcc] class specialization - what is wrong ?

R

Rafal Dabrowa

I try to write template class specialization.
I wrote the following code:

template<class T> class A {
public:
A();
};

template<> class A<char> {
public:
A();
};

template<> A<char>::A() {} // compilation error

GNU g++ compiler reports me the following error:
ts.cc:11: error: template-id `A<>' for `A<char>::A()' does not match any
template declaration

What I'm doing wrong ? How to define non-inline,
specialized class member function ?


Rafal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,414
Latest member
GayleWedel

Latest Threads

Top