// Swap example using rvalue reference & std::move
#include <iostream>
#include <string>
#include <utility>
#include <vector>
template <class T>
void swap_old(T& a, T& b) {
auto tmp{a};
a = b;
b = tmp;
}
template <class T>
void swap_modern(T& a, T& b) {
auto tmp{static_cast<T&&>(a)};
a = static_cast<T&&>(b);
b = static_cast<T&&>(tmp);
This file has been truncated. show original