Exceprt · 1:20am Oct 22nd, 2019
An except from a draft of the C++ standard
\begin{codeblock} 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); } \end{codeblock}
Let's all hope it makes it into the standard :P
I don't see how anypony in their right mind could object to atomic pony princesses.
5143459
Well, you'd have a real mess on your
handshoovesappendages if you tried to do it without atomics and ended up tearing one of them.That's awesome, very cool find!