diff --git a/util.hpp b/util.hpp new file mode 100644 index 0000000..b389725 --- /dev/null +++ b/util.hpp @@ -0,0 +1,20 @@ +#pragma once + +#include "../type/type.hpp" + +namespace util { + +template +inline constexpr T &&forward(type::remove_reference_t &t) noexcept +{ + return static_cast(t); +} + +template +inline constexpr T &&forward(type::remove_reference_t &&t) noexcept +{ + static_assert(!type::is_lvalue_reference_v, "Can not forward an rvalue as an lvalue."); + return static_cast(t); +} + +} // namespace util