I have a class with an atomic member and i want to write a copy constructor:
struct Foo
{
std::atomic mInt;
Foo() {}
Foo(const Foo&am
You only need a stronger memory ordering than memory_order_relaxed
, if your copy operation is supposed to synchronize with other operations on a different thread.
However, this is almost never the case, as a thread safe copy constructor will almost always require some external synchronization or an extra mutex anyway.