I have a class that I want to use in different threads and I think I may be able to use std::atomic this way:
std::atomic
class A { int x; public: A()
Declare the class member x as atomic, then you don't have to declare the object as atomic:
x
class A { std::atomic x; };