Thursday, 3 October 2013

restricting c++ template usage to POD types

restricting c++ template usage to POD types

I have a c++ template class, which only operates correctly if the
templatized type is plain old data. Anything with a constructor that does
anything will not work correctly.
I'd like to somehow get a compiletime or runtime warning when someone
tries to do so anyway.
//this should generate error
myclass<std::string> a;
//this should be fine
myclass<int> b;
is there a trick to do this?