diff --git a/Redcraft.Utility/Source/Public/Templates/ReferenceWrapper.h b/Redcraft.Utility/Source/Public/Templates/ReferenceWrapper.h index 54b7b0c..3ceb3ff 100644 --- a/Redcraft.Utility/Source/Public/Templates/ReferenceWrapper.h +++ b/Redcraft.Utility/Source/Public/Templates/ReferenceWrapper.h @@ -18,7 +18,11 @@ public: using Type = ReferencedType; template requires CConvertibleTo - constexpr TReferenceWrapper(T&& Object) : Pointer(AddressOf(Forward(Object))) { } + constexpr TReferenceWrapper(T&& Object) + { + ReferencedType& Reference = Forward(Object); + Pointer = AddressOf(Reference); + } TReferenceWrapper(const TReferenceWrapper&) = default; diff --git a/Redcraft.Utility/Source/Public/Templates/Utility.h b/Redcraft.Utility/Source/Public/Templates/Utility.h index 6586333..d76e814 100644 --- a/Redcraft.Utility/Source/Public/Templates/Utility.h +++ b/Redcraft.Utility/Source/Public/Templates/Utility.h @@ -21,38 +21,38 @@ void AsConst(const T&& Ref) = delete; template constexpr TRemoveReference&& MoveTemp(T&& Obj) { - typedef TRemoveReference CastType; - return (CastType&&)Obj; + using CastType = TRemoveReference; + return static_cast(Obj); } template -constexpr T CopyTemp(T& Val) +constexpr T CopyTemp(T& Obj) { - return const_cast(Val); + return const_cast(Obj); } template -constexpr T CopyTemp(const T& Val) +constexpr T CopyTemp(const T& Obj) { - return Val; + return Obj; } template -constexpr T&& CopyTemp(T&& Val) +constexpr T&& CopyTemp(T&& Obj) { - return MoveTemp(Val); + return MoveTemp(Obj); } template constexpr T&& Forward(TRemoveReference& Obj) { - return (T&&)Obj; + return static_cast(Obj); } template constexpr T&& Forward(TRemoveReference&& Obj) { - return (T&&)Obj; + return static_cast(Obj); } template requires requires(T& A, T& B) { A.Swap(B); }