/*** Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved. File: auCopyMoveUtils.hpp Date: 2022-2-1 Author: Reece ***/ #pragma once template constexpr AuRemoveReference_t &&AuMove(T &&arg) { return static_cast &&>(arg); } template constexpr T &&AuForward(AuRemoveReference_t &arg) { return static_cast(arg); } template constexpr T &&AuForward(AuRemoveReference_t &&arg) { return static_cast(arg); } template inline T AuExchange(T &obj, U &&newValue) { T oldValue = AuMove(obj); obj = AuForward(newValue); return oldValue; } #if !defined(AURORA_RUNTIME_SWAP) #define AURORA_RUNTIME_SWAP std::swap #endif template inline void AuSwap(T &a, T &b) { AURORA_RUNTIME_SWAP(a, b); }