uis on Nostr: This is from accepted C++20 proposal: ``` union pony { double celestia = 0.; short ...
This is from accepted C++20 proposal:
```
union pony {
double celestia = 0.;
short luna; // padded
};
atomic<pony> princesses = ATOMIC_VAR_INIT({});
bool party(pony desired) {
pony expected;
return princesses.compare_exchange_strong(expected, desired);
}
```
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0528r3.html
```
union pony {
double celestia = 0.;
short luna; // padded
};
atomic<pony> princesses = ATOMIC_VAR_INIT({});
bool party(pony desired) {
pony expected;
return princesses.compare_exchange_strong(expected, desired);
}
```
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0528r3.html