Compile Time Template restriction C++ -
basically have 4 classes: overvoid meta: inherits overvoid physical: has nothing above move: templated class i want move's template accept objects of overvoid type i.e. overvoid , meta. class overvoid{ public: virtual ~overvoid(){ }; }; class meta: public overvoid{ }; class physical{ public: }; template<typename _ty> class move{ }; i want error trown @ compile time, know there way boost cannot use boost (dev issues company) any ideas? you can hide template definition classes not of type overvoid template<typename _ty, class = typename std::enable_if<std::is_base_of<overvoid, _ty>::value>::type> class move{ }; you error when attempting compile class of non-overvoid type. int main() { move<meta> a; move<overvoid> b; move<physical> c; // code goes here return 0; } error: prog.cpp: in function 'int main()': prog.cpp:29:15: error: no type named 'type' in ...