Swapping the Contents of n Variables—Paul Keir

Save to:
Instapaper Pocket Readability

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++20 std::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

You must sign in or register to add a comment.

Comments (0)

There are currently no comments on this entry.