I have a template class, what I want to do are the following
- Make sure that an object is instantiated only if the template parameter passed is a subtype of a desired type
- Communicate to the user of the code upfront what is it that the template parameter must satisfy
(1) is sort of taken care automatically in the sense if the template parameter passed does not support some feature that the class uses the code will not compile. But this error may be detected fairly late. I want the checks to be as early as possible. What I also want to accomplish is that it should be obvious rightaway that template parameter that is passed has to be derived from a base type that I provide.
First, is this misguided ? and if not how shall I do this ? (the simplest way please, C++ is still new to me)
Thanks stackoverflow, you have really speeded up my C++ learning rate.