This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH for c++/41933 (variadic lambda capture)
- From: Adam Butcher <adam at jessamine dot co dot uk>
- To: Jason Merrill <jason at redhat dot com>
- Cc: Gcc Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 16 Sep 2013 08:28:59 +0100
- Subject: Re: C++ PATCH for c++/41933 (variadic lambda capture)
- Authentication-results: sourceware.org; auth=none
Excellent. This now supports the variadic generic lambda from the spec
(albeit without the auto parameter pack)
auto vglambda = [](auto printer)
{
// TODO: return [=](auto&& ... ts) // OK: ts is a function
parameter pack
return [=] <typename... T> (T&& ... ts) // OK: ts is a function
parameter pack
{
printer(std::forward<decltype(ts)>(ts)...);
return [=]()
{
printer(ts ...);
};
};
};
auto p = vglambda( [](auto v1, auto v2, auto v3)
{
std::cout << v1 << v2 << v3;
} );
auto q = p(1, 'a', 3.14); // OK: outputs 1a3.14
q(); // OK: outputs 1a3.14
Just need to get 'auto...' working now for C++14 generic lambda
conformance. (I'm still trying!)
Cheers,
Adam