Swapping arguments using a fold expression.
Swapping the Contents of n Variables
by Paul Keir
From the article:
C++11's
std::swap
is a binary function template which exchanges the contents of its two reference arguments. In C++20std::swap
will likely also permit execution at compile-time. In this post we consider a version which can swap the contents of an arbitrary number of arguments using a C++17 fold-expression...
Add a Comment
Comments are closed.