0
template <typename T1, typename T2>
class Base
{
  T1 t1; 
  T2 t2;
};

template <typename...TN>
class Derived
    : public Base< std::tuple<QList<TN...>>,
                   std::tuple<QVector<TN...>> > //does not work
{
};

Derived<int, double> d;
  • t1 shall become std::tuple<QList<int>, QList<double>>
  • t2 shall become std::tuple<QVector<int>, QVector<double>>

I don't know if this is possible in general. Currently I use preprocessor magic for that. But I hoped that variadic template can do that too. So, can I do any recursive things or any similar to extract the template?

Constructor
  • 7,273
  • 2
  • 24
  • 66
  • 2
    I think `Base< std::tuple...>, std::tuple...> >` should work fine - i.e. you just put the `...` at the wrong place (it expands the previous pattern, and you want to have `QList, QList, and so on` but not `QList`) – dyp Mar 20 '14 at 11:21

1 Answers1

1

As @dyp says, you expanded the pack in the wrong place. It should be like this:

: public Base< std::tuple<QList<TN>...>,
               std::tuple<QVector<TN>...> >
David G
  • 94,763
  • 41
  • 167
  • 253