Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. auto create_closure = [](int x) {
  2. return [=]() {
  3. std::cout << "Number passed into the closure is: " << x << std::endl;
  4. };
  5. };
  6.  
  7. auto closure = create_closure(42);
  8. send(closure.serialize());
  9.  
  10. char *raw = receive();
  11.  
  12. // Does not exist, but this is what I would like:
  13. auto closure = std::function<void()>::load(raw);
  14.  
  15. // Should print "Number passed into the closure is: 42"
  16. closure();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement