lundi 17 décembre 2018

std::async on member function of member field

class Foo
{

private:

    std::unique_ptr<Bar>& bar;
    int retVal;
    std::future<int> myFuture = std::async(std::launch::async, &Foo::bar->myMethod, this);

    Foo(std::unique_ptr<Bar>& bar_) : bar(bar_) {}

}

I believe this sums up the topic, as this doesn't work. How can I launch myFuture on Bar::myMethod?

Aucun commentaire:

Enregistrer un commentaire