1

I'm trying to make "compound" template type. Something like this

template <typename A, typename T>
class configurator
{
public:
    configurator(const A<T> & adapter) : m_adapter(adapter) {}
private:
    A<T> m_adapter;
};

Compiler complains with

error: expected ')'
    configurator(const A<T> & adapter
                        ^

Why this is not working? Is it possible to make it work?

songyuanyao
  • 169,198
  • 16
  • 310
  • 405
Rostfrei
  • 454
  • 6
  • 12

1 Answers1

5

A is declared as type template parameter; you can't use it as template-name and specify template argument for it.

You want template template parameter. e.g.

template <template <typename> typename A, typename T>
class configurator

BTW if A is supposed to work with multiple template arguments you could specify A with template parameter pack:

template <template <typename...> typename A, typename T>
class configurator
songyuanyao
  • 169,198
  • 16
  • 310
  • 405