dimanche 28 juin 2020

How to call the lambda stored in pointer to the `std::function`?

I have a pointer to std::function that stores lambda inside. How can I call that lambda?

example:

std::function <void()>* fx = new std::function <void()>([] {std::cout << "Hello world;\n"; });
    //here i need to call my fx, just fx(); does not works in this case

fx may be stored inside std::pair

Aucun commentaire:

Enregistrer un commentaire