She*_*evy 7 c++ atomic segmentation-fault c++11
在linux上,使用gcc 4.8.4,使用-std = c ++ 11 -mcx16编译:
#include <atomic>
struct node_t;
struct pointer_t {
node_t* ptr;
unsigned int count;
pointer_t() noexcept : ptr{nullptr}, count{0} {}
};
struct empty {};
struct node_t {
empty value;
std::atomic<pointer_t> next;
node_t() : next{pointer_t{}} {}
};
int main() {
node_t{}.next.load();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
在load
调用时给出段错误.我是怎么想初始化原子值的?