What does "unspecialized class template can't be used as a template argument" mean?

12,388

Solution 1

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).

Solution 2

It should be public Singleton<AbstractRManagers<Type> > as AbstractRManagers is a template you need to provide the concrete type to instantiate it.

Share:
12,388
Chris Condy
Author by

Chris Condy

Updated on July 28, 2022

Comments

  • Chris Condy
    Chris Condy almost 2 years

    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

  • user541686
    user541686 over 2 years
    I think your answer doesn't really address the heart of the issue. Note that you don't need to provide the arguments when you're inside the class, so it's not at all clear (to me, anyway) why the requirement is still there in the inheritance list.