diff --git a/BAN/include/BAN/Move.h b/BAN/include/BAN/Move.h index 056d26b32..1270874e5 100644 --- a/BAN/include/BAN/Move.h +++ b/BAN/include/BAN/Move.h @@ -3,17 +3,36 @@ namespace BAN { - template - struct RemoveReference { typedef T type; }; + template + struct RemoveReference { using type = T; }; + template + struct RemoveReference { using type = T; }; + template + struct RemoveReference { using type = T; }; - template - struct RemoveReference { typedef T type; }; + template + struct IsLValueReference { static constexpr bool value = false; }; + template + struct IsLValueReference { static constexpr bool value = true; }; - template - struct RemoveReference { typedef T type; }; - template - typename RemoveReference::type&& - Move( T&& Arg ) { return (typename RemoveReference::type&&)Arg; } + template + constexpr typename RemoveReference::type&& Move(T&& arg) + { + return static_cast::type&&>(arg); + } + + template + constexpr T&& Forward(typename RemoveReference::type& arg) + { + return static_cast(arg); + } + + template + constexpr T&& Forward(typename RemoveReference::type&& arg) + { + static_assert(!IsLValueReference::value); + return static_cast(arg); + } } \ No newline at end of file