jeudi 2 février 2017

how to do function template specialization for class templates?

For example

template<class T>
T make()
{
   return T();
}

and I want to specialize it when T is a class template A;

template<int N>
class A
{};

template<int N>
A<N> make<A<N>>()
{
   ...
};

Error in compilation: illegal use of explicit template arguments

How to do it?

Aucun commentaire:

Enregistrer un commentaire