↧
Answer by Jarod42 for in-class initialization of atomic
atomic<int> x = 1; // not an assignment.isatomic<int> x{atomic<int>{1}};whereas atomic<int> x;x = 1; // assignment
View ArticleAnswer by Lightness Races in Orbit for in-class initialization of atomic
std::atomic<int> x = 1; is copy-initialisation, and basically does this:std::atomic<int> x{std::atomic<int>{1}};Your compiler actually doesn't complain about operator=, but instead...
View Articlein-class initialization of atomic
Why in this examplestruct Foo { atomic<int> x = 1;};the compiler (gcc 4.8) is trying to use the atomic& operator=(const atomic&) which is deleted, (hence the example wont compile), while...
View Article
More Pages to Explore .....