fix(templates): fix TOptional constraints and implementation
This commit is contained in:
parent
494928aa6b
commit
d634fc3cf8
@ -26,6 +26,10 @@ private:
|
|||||||
|| TIsConvertible<const TOptional<T>&, OptionalType>::Value
|
|| TIsConvertible<const TOptional<T>&, OptionalType>::Value
|
||||||
|| TIsConvertible< TOptional<T>&&, OptionalType>::Value
|
|| TIsConvertible< TOptional<T>&&, OptionalType>::Value
|
||||||
|| TIsConvertible<const TOptional<T>&&, OptionalType>::Value
|
|| TIsConvertible<const TOptional<T>&&, OptionalType>::Value
|
||||||
|
|| TIsAssignable<OptionalType&, TOptional<T>& >::Value
|
||||||
|
|| TIsAssignable<OptionalType&, const TOptional<T>& >::Value
|
||||||
|
|| TIsAssignable<OptionalType&, TOptional<T>&&>::Value
|
||||||
|
|| TIsAssignable<OptionalType&, const TOptional<T>&&>::Value
|
||||||
)> { };
|
)> { };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -120,11 +124,9 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T = OptionalType> requires TIsConstructible<OptionalType, const T&>::Value && TIsAssignable<OptionalType, const T&>::Value && TAllowUnwrapping<T>::Value
|
template <typename T = OptionalType> requires TIsConstructible<OptionalType, const T&>::Value && TIsAssignable<OptionalType&, const T&>::Value && TAllowUnwrapping<T>::Value
|
||||||
constexpr TOptional& operator=(const TOptional<T>& InValue)
|
constexpr TOptional& operator=(const TOptional<T>& InValue)
|
||||||
{
|
{
|
||||||
if (&InValue == this) return *this;
|
|
||||||
|
|
||||||
if (!InValue.IsValid())
|
if (!InValue.IsValid())
|
||||||
{
|
{
|
||||||
Reset();
|
Reset();
|
||||||
@ -141,11 +143,9 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T = OptionalType> requires TIsConstructible<OptionalType, T&&>::Value && TIsAssignable<OptionalType, T&&>::Value && TAllowUnwrapping<T>::Value
|
template <typename T = OptionalType> requires TIsConstructible<OptionalType, T&&>::Value && TIsAssignable<OptionalType&, T&&>::Value && TAllowUnwrapping<T>::Value
|
||||||
constexpr TOptional& operator=(TOptional<T>&& InValue)
|
constexpr TOptional& operator=(TOptional<T>&& InValue)
|
||||||
{
|
{
|
||||||
if (&InValue == this) return *this;
|
|
||||||
|
|
||||||
if (!InValue.IsValid())
|
if (!InValue.IsValid())
|
||||||
{
|
{
|
||||||
Reset();
|
Reset();
|
||||||
@ -162,7 +162,7 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T = OptionalType> requires TIsConstructible<OptionalType, T&&>::Value && TIsAssignable<OptionalType, T&&>::Value
|
template <typename T = OptionalType> requires TIsConstructible<OptionalType, T&&>::Value && TIsAssignable<OptionalType&, T&&>::Value
|
||||||
constexpr TOptional& operator=(T&& InValue)
|
constexpr TOptional& operator=(T&& InValue)
|
||||||
{
|
{
|
||||||
if (IsValid()) GetValue() = Forward<T>(InValue);
|
if (IsValid()) GetValue() = Forward<T>(InValue);
|
||||||
|
Loading…
Reference in New Issue
Block a user