Fix cx::swap to use move semantics
This commit is contained in:
parent
981e57b34c
commit
d876f65e7b
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user