Lamba captures with move semantics in C++ 11

It is possible to move values into lambda's in C++ 11 but it requires a wrapper. Here is what I am using.  It should only be used in this context as when it is copied it acts like a move and sucks the guts out of the source. I needed this where I had to supply a shared_ptr to a class to an async event callback and needed to keep it in scope past the lifetime of the parent. I did not want to store the "global" and copying would keep the lifetime alive well past the end of the callback


No comments:

Post a Comment