Use std::swap instead of custom methods
std::swap
works out-of-the-box for objects that are MoveAssignable
and MoveConstructible
, see https://stackoverflow.com/q/39675073. If it does not work out-of-the box, std::swap
can be overloaded for custom objects. Hence, std::swap
should be preferred instead of custom swap
methods which do just the trivial thing in most cases.
Since C++20 std::swap
will be constexpr
so it will be possible to remove even the TNL::swap function.