I have a class called AbstractRManagers which i would like to inheritent from a singleton template class Singleton but the abstractRmanager needing to be a template class I have come across some strange error codes that provide no use, Ive tried looking it up but to no luck.
template <class Type>
class AbstractRManagers : public Singleton<AbstractRManagers>
{
error C3203: 'AbstractRManagers' : unspecialized class template can't be used as a template argument for template parameter 'Type', expected a real type
A template parameter is a special kind of parameter that can be used to pass a type as argument: just like regular function parameters can be used to pass values to a function, template parameters allow to pass also types to a function.
Can default arguments be used with the template class? Explanation: The template class can use default arguments.
A template argument for a template template parameter is the name of a class template. When the compiler tries to find a template to match the template template argument, it only considers primary class templates. (A primary template is the template that is being specialized.)
There are ways to restrict the types you can use inside a template you write by using specific typedefs inside your template. This will ensure that the compilation of the template specialisation for a type that does not include that particular typedef will fail, so you can selectively support/not support certain types.
AbstractRManagers
names a template, which isn't a type -- it has to have a template parameter give to become a type. At least if I understand what you want, you probably need something like:
template <class Type>
class AbstractRManagers : public Singleton<AbstractRManagers<Type> >
...which starts to look suspiciously CRTP-like.
Then the obligatory note: chances are pretty good that you don't really need or want a singleton here (or nearly anywhere).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With