I am trying to build a class template that inherits the class. If the class template is given a primitive type as template argument, then it gives an illegal inheritance error. I tried doing
template <class Class_>
struct EndianGuard_ : public Class_ {
EndianGuard_ () {
cout << "Guarding a Class" << endl;
}
}
template <typename PrimitiveType_>
struct EndianGuard_ {
EndianGuard_ (PrimitiveType_ Value) : Value(Value) {
cout << "Guarding a primitive type" << endl;
}
PrimitiveType_ Value;
}
of course I knew it doesn't work that way but I am desperate. How can I differentiate primitive type and a structure?