11 ms·
What about inside the implementation of a sorting routine? Or the move assign operator of a smart pointer? There are plenty of legitimate reasons to swap variab
by wheybags 5y ago
What about inside the implementation of a sorting routine? Or the move assign operator of a smart pointer? There are plenty of legitimate reasons to swap variables, not everyone is making a crud app.
- jacquesm 5y agoWhen implementing a sorting routine the typical 'swap' operation is two loads and stores from memory, and the order of the loads and stores is what effects the swap, you don't typically do swap-in-place with memory.