I’ve a class which is a wrapper class(serves as a common interface) around another class implementing the functionality required. So my code looks like this.
template<typename ImplemenationClass> class WrapperClass { // the code goes here }
Now, how do I make sure that ImplementationClass can be derived from a set of classes only, similar to java’s generics
<? extends BaseClass>
syntax?
It’s verbose, but you can do it like this:
This requires a compiler with good support for the standard (most recent compilers should be fine but old versions of Visual C++ won’t be). For more information, see the Boost.Enable_If documentation.
As Ferruccio said, a simpler but less powerful implementation: