I have a generic type for my class, but the generic type itself needs to implement the hash() function. Can I require this in my class declaration?
I can easily just make sure I put in a hash() function into the class I pass to myClass, but I would like to get a compilation error if it doesn't exist.
template <typename _T>
class myClass
{
_T* list;
public:
myClass(){
this->list = (_T*)malloc(10,sizeof(_T));
for(int i = 0;i < 10; i++){
this->list[i]=_T(i);
}
}
unsigned int doTheThingIWant(){
return this->list[0].hash()
}
};
Does anyone know how to force the _T type to have hash() implemented?