I have a templated class
template <typename T>
class MyContainerClass
For types to be substituted for T, it has to satisfy many requirements: for example, get_id(), int data(), etc.
Obviously none of the fundamental types (PODs) are substitutable. One way I can provide this is via wrappers for the PODs that provide these functions. Is this an acceptable way?
Another way would be to change the template to:
template < typename T, typename C=traits<T> >
class MyContainerClass
and inside MyContainerClass, call traits::data() instead of data() on T objects.
I will specialize traits<int>, traits<const char *>
etc.
Is this good design ? How do I design such a traits class (completely static methods or allow for inheritance) ? Or are the wrapper classes a good solution?
What other alternatives are there?