Here is my class
class Foo
{
public:
void foo(const std::string&);
};
int main()
{
Foo* pFoo = new Foo();
std::string str = "string";
//If I want to start an async task, I could do this:
std::async(std::launch::async, std::bind(&Foo::foo, pFoo, std::placeholders::_1), str);
//or do this:
std::async(std::launch::async, std::bind(&Foo::foo, pFoo, str));
}
So what's the difference?Which way is safer to use?
Aucun commentaire:
Enregistrer un commentaire