Brackets and unpacking of template variable parameters

Possible duplicate:
Can brackets accept arbitrary identifiers as arguments? C ++

My question is using the batch decompress operator .... The following code fragment gives a compiler error (expected package of parameters up to "...", in the last line), in g ++ 4.7.1, and I wonder why.

template<class T> struct type_wrapper 
{ typedef T type; };

template<class...Ts> struct variadic_wrapper { };

// This compiles:
template<class...Ts> struct variadic_type_wrapper 
{ typedef variadic_wrapper<typename type_wrapper<Ts>::type...> type; };

// Parentheses screw it up:
// Error: expected parameter pack before '...'
template<class...Ts> struct variadic_type_wrapper
{ typedef variadic_wrapper<(typename type_wrapper<Ts>::type)...> type; };   

Is the expression (...)hiding the arch of the base type? Thanks for making this clear!

+5
source share

All Articles