Why does an in-place member initialization use a copy constructor in C++11?
问题 I'm a little bit confused about the following code: struct A { std::atomic<int> a = 0; }; Which gives an error: copying member subobject of type 'std::atomic' invokes deleted constructor But almost the same code does work: struct A { std::atomic<int> a = {0}; }; Okey, if the first variant requires the copy constructor, then it have to use operator=() . But wait! This operator perfectly works without the copy constructor: A a; a.a = 1; Can anyone explain how both of the in-place