xieite ::rot_swap ()
Defined in fragment xieite :rot_swap
(header-only:
<xieite/algo/rot_swap.hpp>
)
Swaps the values of multiple references by rotating their values to the left.
When rotating by multiple spaces, internally uses the least possible number of temporary copies.
Declaration
template <std ::size_t n =1 ,typename... Args >constexpr std ::tuple <Args &... >rot_swap (Args &... args )noexcept ((... && (std ::is_nothrow_move_constructible_v <Args > &&std ::is_nothrow_move_assignable <Args >)));
Example
Output:import std ;import xieite ;int main () {int a =1 ;int b =2 ;int c =3 ;xieite ::dump (a ,b ,c );xieite ::rot_swap (a ,b ,c );xieite ::dump (a ,b ,c ); }
1 2 3 2 3 1