Use C++11 moves instead of swaps where possible.