cpp-utils/include/move.hpp
2022-06-23 17:26:19 +01:00

12 lines
383 B
C++

#pragma once
#include "type_traits.hpp"
// static_cast to rvalue reference
#define MOV(...) \
static_cast<remove_reference_t<decltype(__VA_ARGS__)>&&>(__VA_ARGS__)
// static_cast to identity
// The extra && aren't necessary as discussed above, but make it more robust in case it's used with a non-reference.
#define FWD(...) \
static_cast<decltype(__VA_ARGS__)&&>(__VA_ARGS__)