RosettaCodeData/Task/Generic-swap/C++/generic-swap-3.cpp

7 lines
121 B
C++

template<class T>
void swap(T &lhs, T &rhs){
T tmp = std::move(lhs);
lhs = std::move(rhs);
rhs = std::move(tmp);
}