Fix cx::swap to use move semantics

This commit is contained in:
rexy712 2020-05-07 11:54:56 -07:00
parent 981e57b34c
commit d876f65e7b

View File

@ -27,11 +27,12 @@ namespace rexy::cx{
namespace{
template<class T>
constexpr void swap(T& l, T& r)
noexcept(std::is_nothrow_copy_assignable<T>::value)
noexcept(std::is_nothrow_move_assignable<T>::value &&
std::is_nothrow_move_constructible<T>::value)
{
T tmp = l;
l = r;
r = tmp;
T tmp = std::move(l);
l = std::move(r);
r = std::move(tmp);
}
template<class T, class U = T>
constexpr T exchange(T& l, U&& r)