C++0x Variadic Parameter Pack: Syntax

Viewed 446

the following code snippet won't compile under gcc4.6.1:

template <typename... TS>
void do_stuff(TS... ts)
{
  auto f = [](TS... things) { };
}

It throws an error stating that the pack things was not expanded. The following code does compile however:

template <typename... TS>
void do_stuff(TS... ts)
{
  auto f = [](TS... things...) { };
}

Notice the extra unpacking operator after things inside the parameter list. I've never seen a situation where a variadic pack had to be expanded during its declaration. So my question to you kind folks is:

Is this legal C++0x syntax (the snippet that compiles) or is it just a quirk with GCC when it comes to dealing with variadic types?

1 Answers
Related