27 lines
579 B
C++
27 lines
579 B
C++
#pragma once
|
|
|
|
#include "../type/type.hpp"
|
|
|
|
namespace util {
|
|
|
|
template <typename T>
|
|
inline constexpr type::remove_reference_t<T> &&move(T &&t) noexcept
|
|
{
|
|
return static_cast<type::remove_reference_t<T> &&>(t);
|
|
}
|
|
|
|
template <typename T>
|
|
inline constexpr T &&forward(type::remove_reference_t<T> &t) noexcept
|
|
{
|
|
return static_cast<T &&>(t);
|
|
}
|
|
|
|
template <typename T>
|
|
inline constexpr T &&forward(type::remove_reference_t<T> &&t) noexcept
|
|
{
|
|
static_assert(!type::is_lvalue_reference_v<T>, "Can not forward an rvalue as an lvalue.");
|
|
return static_cast<T &&>(t);
|
|
}
|
|
|
|
} // namespace util
|