以下のプログラムでは、メンバー関数を使用して packaged_task を作成しようとしています。
#include <future>
using namespace std;
struct S
{
int calc(int& a)
{
return a*a;
}
};
int main()
{
S s;
auto bnd = std::bind(&S::calc, s);
std::packaged_task<int(int&)> task( bnd);
return 0;
}
残念ながら、この試みはエラーになります。
これはどのように行うことができますか?