Ok thanks... and it is slow:
On Friday, 16 July 2021 11:28:46 PDT Phil Bouchard via Std-Proposals wrote:I just realized that swap() is not using the XCHG assembly instruction at all. Maybe adding an atomic_swap() could achieve this?No, that won't work. You can't atomically swap two memory locations. If only one of the two variables needs to be atomically swapped, we already have a function for that, atomic_exchange().