代碼:
std::thread t1(do_detect, vector1, face1, pic_paths1);
編譯報錯:
thread:342:5: error: attempt to use a deleted function __invoke(_VSTD::move(_VSTD::get<1>(__t)), _VSTD::move(_VSTD::get<_Indices>(__t))...);
原因是C++11構(gòu)造函數(shù)中傳入時要求必須是引用讨跟,不然會調(diào)用move方法,而move方法已經(jīng)棄用
需要改為(傳入引用):
std::thread t1(std::ref(do_detect), std::ref(vector1), std::ref(face1), std::ref(pic_paths1));