2

For example

struct A { typedef int Type; }
struct B { typedef float Type; }

template<class... Ts>
struct C
{
    typedef tuple<Ts::Type...> TupleType; // comilation error: parameter pack 
                                          // expects a type template argument
};

How to unpack type-defined types?

Constructor
  • 7,273
  • 2
  • 24
  • 66
user1899020
  • 13,167
  • 21
  • 79
  • 154
  • possible duplicate of [Where and why do I have to put the "template" and "typename" keywords?](http://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords) – Constructor May 19 '14 at 16:37

1 Answers1

6

You need typename.

typedef tuple<typename Ts::Type...> TupleType;

Note that this has nothing to do with the fact that you're dealing with a parameter pack. You need typename here for the same reason as usual. In fact, if you had for instance

template<class T>
struct D {
    typedef vector<typename T::type> VectorType;
};

the typename would be necessary here too.

Brian Bi
  • 111,498
  • 10
  • 176
  • 312