#include <iostream>#include <thread>using namespace std;class test{public:void output(const int a){cout << a << endl;}void work(const int a){thread th(output,a);th.join();}};int main(){test t;t.work(10);/******or/thread th(t.work,10);/th.join();*******/return 0;}寫個程序試一下,想在自定義的類的函數中使用thread或者把自定義的類的函數作為thread的驅動函數,但是上面兩種寫法都不行。/******or/thread th(t.output,10);/th.join();*******/注釋里面應該是這樣
添加回答
舉報
0/150
提交
取消