Open
Description
[ Note: For example, the effect of
compare_exchange_strong
isif (memcmp(this, &expected, sizeof(*this)) == 0) memcpy(this, &desired, sizeof(*this)); else memcpy(expected, this, sizeof(*this));
— end note ]
This is wrong in a multitude of ways... not least of which is that that's not even atomic. But also this assumes that sizeof(atomic<T>) == sizeof(T)
, that the layout of an atomic
directly contains a T
, and so on.