Daily bit(e) of C++ | std::iter_swap
Daily bit(e) of C++ ♻️39, Swapping values behind iterators and other indirect types using std::iter_swap.
The std::iter_swap is a convenient shorthand for indirectly swapping values, i.e. swapping the values pointed to by two iterators.
While the original version std::iter_swap is only intended for iterators, the range C++20 version std::ranges::iter_swap can work with any indirectly movable type and supports customization through ADL.