Why are std::atomic objects not copyable?

On platforms without atomic instructions (or without atomic instructions for all integer sizes) the types might need to contain a mutex to provide atomicity. Mutexes are not generally copyable or movable.

In order to keep a consistent interface for all specializations of std::atomic<T> across all platforms, the types are never copyable.

Leave a Comment