refactor(templates): do not allow TReferenceWrapper to rebind a new object
This commit is contained in:
parent
ac9e0d38a6
commit
ca67769796
@ -25,20 +25,18 @@ public:
|
||||
}
|
||||
|
||||
FORCEINLINE constexpr TReferenceWrapper(const TReferenceWrapper&) = default;
|
||||
FORCEINLINE constexpr TReferenceWrapper(TReferenceWrapper&&) = default;
|
||||
|
||||
template <typename T = ReferencedType> requires (CConvertibleTo<T&, ReferencedType&>)
|
||||
FORCEINLINE constexpr TReferenceWrapper(const TReferenceWrapper<T>& InValue)
|
||||
: Pointer(InValue.Pointer)
|
||||
{ }
|
||||
|
||||
FORCEINLINE constexpr TReferenceWrapper& operator=(const TReferenceWrapper&) = default;
|
||||
template <typename T = ReferencedType> requires (CAssignableFrom<ReferencedType&, T&&>)
|
||||
FORCEINLINE constexpr TReferenceWrapper& operator=(T&& Object) { Get() = Forward<T>(Object); return *this; }
|
||||
|
||||
template <typename T = ReferencedType> requires (CConvertibleTo<T&, ReferencedType&>)
|
||||
FORCEINLINE constexpr TReferenceWrapper& operator=(const TReferenceWrapper<T>& InValue)
|
||||
{
|
||||
Pointer = InValue.Pointer;
|
||||
return *this;
|
||||
}
|
||||
FORCEINLINE constexpr TReferenceWrapper& operator=(const TReferenceWrapper&) = delete;
|
||||
FORCEINLINE constexpr TReferenceWrapper& operator=(TReferenceWrapper&&) = delete;
|
||||
|
||||
FORCEINLINE constexpr operator ReferencedType&() const { return *Pointer; }
|
||||
FORCEINLINE constexpr ReferencedType& Get() const { return *Pointer; }
|
||||
|
Loading…
Reference in New Issue
Block a user