2

Consider

#include <iostream>
#include <atomic>

struct Foo
{
    std::atomic_int atomic;
};

int main() {
    Foo f{1};
}

Fails to compile (gcc, C++14) with error

error: use of deleted function ‘std::atomic<int>::atomic(const std::atomic<int>&)’

(Note that MSVC compiles the code.)

P45 Imminent
  • 8,319
  • 4
  • 35
  • 78

0 Answers0