makiolo

question lambdas

Dec 10th, 2015
101
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // I want template in lambdas (exists something like that?)
  2. fes::sync<std::string> process;
  3. process.connect(
  4.     template <typename ... Args>
  5.     [](Args&& ... args) {
  6.         auto src = m::make_tuple(std::forward<Args>(args)...);
  7.         // ...
  8.     }
  9. );
  10.  
  11. // but don't compile in clang 3.6 (c++14)
  12. // my solution now is use functor with variadic templates, works!
  13. class serialize_functor
  14. {
  15. public:
  16.     template <typename ... Args>
  17.     void operator()(Args&& ... args)
  18.     {
  19.         auto src = m::make_tuple(std::forward<Args>(args)...);
  20.         // ...
  21.     }
  22. };
  23. fes::sync<std::string> process;
  24. process.connect(ser::unserialize_functor<int, bool, std::string>());
RAW Paste Data