【发布时间】:2021-03-27 22:07:18
【问题描述】:
我在我的代码中使用了 std::call_once,它编译成功但在运行时崩溃了... 喜欢这个演示:
#include <iostream>
#include <mutex>
using namespace std;
int main()
{
cout << "Hello world" << endl;
static once_flag of;
call_once(of,[]{});
cout << "see you again" << endl;
return 0;
}
【问题讨论】:
-
您可以按照建议的方式轻松编辑原始question,只需添加图像即可。我对你为什么发布一个新问题感到很困惑。看起来更多的努力没有任何好处。
标签: c++ c++11 pthreads std gcc7