lambda and shared_ptr?

All,
I'm trying to use lambda and shared_ptr together, but I'm running into a
problem. Please see the code below.
I'd like the lambda-generated functor to hold the shared_ptr by value,
such that its ref count is incremented. This doesn't seem to be
happening. Instead, the shared_ptr is deleted when foo() returns,
resulting in undefined behavior.
What am I doing wrong?
Thanks,
Mark
#include
participants (2)
-
Mark Santaniello (AMD)
-
Peter Dimov