我将尝试按如下方式将原子变量传递给函数:
运行以上代码时,我遇到了以下错误:
错误 2 错误 C2280: 'std::atomic::atomic(const std::atomic &)' : 尝试引用已删除的函数 c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional 1149 1 klu_factor 有人知道如何解决吗?非常感谢您的帮助。
// function factor receives an atomic variable
void factor(std::atomic<int> ThreadsCounter)
{
.........
}
// main starts here
int main()
{
// Atomic variable declaration
std::atomic<int> ThreadsCounter(0);
// passing atomic variable to the function factor through a thread
Threadlist[0] = std::thread (factor, std::ref(ThreadsCounter));
Threadlist[0].join();
return 0;
}
运行以上代码时,我遇到了以下错误:
错误 2 错误 C2280: 'std::atomic::atomic(const std::atomic &)' : 尝试引用已删除的函数 c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional 1149 1 klu_factor 有人知道如何解决吗?非常感谢您的帮助。