This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ PATCH for c++/41933 (variadic lambda capture)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]