mardi 3 mars 2015

Best way to write a conditionally selectable constructor

I have the following code in C++:



struct A;

struct B
{
B(){}

template<typename T>
B(T param){}
};


I want the constructor template to be valid only when the typename T is convertible to the type A. What is the best way to accomplish this?


Aucun commentaire:

Enregistrer un commentaire