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
class
Yust a quick idea, I'm sure there are better approaches:
template struct protector {
static const int result = 1;
};
template <> struct protector {
static const int result = -1;
};
template
class MyClass
{
private:
char isfine[protector::result];
};
It might be better, however, to put a fat comment over your code to keep users from instantiating with the wrong types :-)