我有一个功能如下
void test(const int * x, int d){
for(int i=0; i<d ; i++)
cout<< x[i] << endl;
}
当我尝试使用 boost::thread 运行它时
int n=10;
int * x1=new int[n];
boost::thread *new_thread = new boost::thread(& test,x1,n);
我收到以下编译错误
error: no matching function for call to ‘boost::thread::thread(<unresolved overloaded function type>, int*&, uint16_t&)’
/usr/include/boost/thread/detail/thread.hpp:216: note: candidates are: boost::thread::thread(boost::detail::thread_move_t<boost::thread>)
/usr/include/boost/thread/detail/thread.hpp:155: note: boost::thread::thread()
/usr/include/boost/thread/detail/thread.hpp:123: note: boost::thread::thread(boost::detail::thread_data_ptr)
/usr/include/boost/thread/detail/thread.hpp:114: note: boost::thread::thread(boost::thread&)
main.cpp:397: warning: unused variable ‘new_thread’
确实,我是新手来提升。谢谢你。