相关疑难解决方法(0)

"使用已删除的函数"错误与std :: atomic_int

我想使用std::atomic_int变量.在我的代码中,我有:

#include <atomic>

std::atomic_int stop = 0;

int main()
{
    // Do something
}
Run Code Online (Sandbox Code Playgroud)

这给了我一个编译错误:

use of deleted function 'std::__atomic_base<_IntTp>::__atomic_base(const std::__atomic_base<_IntTp>&) [with _ITp = int]'
 std::atomic_int stop = 0;
                        ^
Run Code Online (Sandbox Code Playgroud)

对于发生了什么有什么想法?

c++ c++11 stdatomic

24
推荐指数
1
解决办法
2万
查看次数

标签 统计

c++ ×1

c++11 ×1

stdatomic ×1