Can a parameter pack be captured implicitly within C++11 lambdas?
问题 Does anyone know if the following implicit capture of 'ts' is well-formed: template<class ... Ts> void bar(Ts ... ts) { } template<class ... Ts> int foo(Ts ... ts) { auto L = [=] () { bar(ts...); }; L(); return 0; } int g = foo(1, 2, 3); Does the standard clearly state anywhere that this should not be well formed? 回答1: 14.5.3/6: The instantiation of a pack expansion that is not a sizeof... expression produces a list E1, E2, ..., EN , where N is the number of elements in the pack expansion