dimanche 29 octobre 2017

Controlling the lifetime of a lambda

I saw in What is the lifetime of a C++ lambda expression? that a lambda lifetime is limited to the scope where it was defined.

How can I instantiate a lambda whose lifetime I control (using new, delete)? If it was a functor I would simply do new MyFunc(), but don't know how to do it with Lambdas. Thanks.

Aucun commentaire:

Enregistrer un commentaire