【发布时间】:2012-09-02 13:47:55
【问题描述】:
#include <atomic>
std::atomic<int> outside(1);
class A{
std::atomic<int> inside(1); // <--- why not allowed ?
};
prog.cpp:4:25: error: expected identifier before numeric constant
prog.cpp:4:25: error: expected ',' or '...' before numeric constant
在 VS11 中
C2059: syntax error : 'constant'
【问题讨论】:
-
尝试里面 = std::atomic
(0); -
我认为课堂内的
()存在历史问题。你试过=而不是大括号吗? -
@iammilind 猜猜看。它在外面有效,但在里面无效.....
标签: c++ constructor c++11 initialization default-value