Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can assign a c++ lambda into an object for later use, you just have to be careful about capture by reference and capturing pointer types... But the capture using the copy constructor is handy here, eg. you can copy a shared_ptr and get reference counted captures...

It's funny in this way how c++ lambdas lead to very c++ specific issues and uniquely c++-ish solutions. I think the wackiness of the closure capture mechanism is the best example of this I can think of.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: