Force type of C++ template
- by gregseth
Hi,
I've a basic template class, but I'd like to restrain the type of the specialisation to a set of classes or types. e.g.:
template <typename T>
class MyClass
{
.../...
private:
T* _p;
};
MyClass<std::string> a; // OK
MYCLass<short> b; // OK
MyClass<double> c; // not OK
Those are just examples, the allowed types may vary.
Is that even possible? If it is, how to do so?
Thanks.