diff --git a/Redcraft.Utility/Source/Public/Templates/Optional.h b/Redcraft.Utility/Source/Public/Templates/Optional.h index 0f5b38f..dc77517 100644 --- a/Redcraft.Utility/Source/Public/Templates/Optional.h +++ b/Redcraft.Utility/Source/Public/Templates/Optional.h @@ -58,7 +58,7 @@ public: FORCEINLINE constexpr explicit (!CConvertibleTo) TOptional(T&& InValue) : TOptional(InPlace, Forward(InValue)) { } - + /** Constructs an object with initial content an object, direct-non-list-initialized from Forward(Args).... */ template requires (CConstructibleFrom) FORCEINLINE constexpr explicit TOptional(FInPlace, Ts&&... Args) @@ -66,7 +66,7 @@ public: { new (&Value) OptionalType(Forward(Args)...); } - + /** Constructs an object with initial content an object, direct-non-list-initialized from IL, Forward(Args).... */ template requires (CConstructibleFrom, Ts...>) FORCEINLINE constexpr explicit TOptional(FInPlace, initializer_list IL, Ts&&... Args) @@ -96,7 +96,7 @@ public: } /** Converting copy constructor. */ - template requires (CConstructibleFrom && NAMESPACE_PRIVATE::CTOptionalAllowUnwrappable) + template requires (CConstructibleFrom && NAMESPACE_PRIVATE::CTOptionalAllowUnwrappable) FORCEINLINE constexpr explicit (!CConvertibleTo) TOptional(const TOptional& InValue) : bIsValid(InValue.IsValid()) { @@ -104,7 +104,7 @@ public: } /** Converting move constructor. */ - template requires (CConstructibleFrom && NAMESPACE_PRIVATE::CTOptionalAllowUnwrappable) + template requires (CConstructibleFrom && NAMESPACE_PRIVATE::CTOptionalAllowUnwrappable) FORCEINLINE constexpr explicit (!CConvertibleTo) TOptional(TOptional&& InValue) : bIsValid(InValue.IsValid()) { @@ -136,7 +136,7 @@ public: } if (IsValid()) GetValue() = InValue.GetValue(); - else + else { new (&Value) OptionalType(InValue.GetValue()); bIsValid = true; @@ -171,7 +171,7 @@ public: } /** Assigns by copying the state of 'InValue'. */ - template requires (CConstructibleFrom + template requires (CConstructibleFrom && CAssignableFrom && NAMESPACE_PRIVATE::CTOptionalAllowUnwrappable) constexpr TOptional& operator=(const TOptional& InValue) { @@ -192,7 +192,7 @@ public: } /** Assigns by moving the state of 'InValue'. */ - template requires (CConstructibleFrom + template requires (CConstructibleFrom && CAssignableFrom && NAMESPACE_PRIVATE::CTOptionalAllowUnwrappable) constexpr TOptional& operator=(TOptional&& InValue) { @@ -225,9 +225,9 @@ public: return *this; } - + /** Check if the two optional are equivalent. */ - template requires (CWeaklyEqualityComparable) + template requires (CWeaklyEqualityComparable) NODISCARD friend FORCEINLINE constexpr bool operator==(const TOptional& LHS, const TOptional& RHS) { if (LHS.IsValid() != RHS.IsValid()) return false; @@ -236,7 +236,7 @@ public: } /** Check the order relationship between two optional. */ - template requires (CSynthThreeWayComparable) + template requires (CSynthThreeWayComparable) NODISCARD friend FORCEINLINE constexpr partial_ordering operator<=>(const TOptional& LHS, const TOptional& RHS) { if (LHS.IsValid() != RHS.IsValid()) return partial_ordering::unordered; @@ -245,14 +245,14 @@ public: } /** Check if the optional value is equivalent to 'InValue'. */ - template requires (!CTOptional && CWeaklyEqualityComparable) + template requires (!CTOptional && CWeaklyEqualityComparable) NODISCARD FORCEINLINE constexpr bool operator==(const T& InValue) const& { return IsValid() ? GetValue() == InValue : false; } /** Check that the optional value is in ordered relationship with 'InValue'. */ - template requires (!CTOptional && CSynthThreeWayComparable) + template requires (!CTOptional && CSynthThreeWayComparable) NODISCARD FORCEINLINE constexpr partial_ordering operator<=>(const T& InValue) const& { return IsValid() ? SynthThreeWayCompare(GetValue(), InValue) : partial_ordering::unordered; @@ -280,7 +280,7 @@ public: return *Result; } - + /** * Changes the contained object to one constructed from the arguments. * First destroys the current contained object (if any) by Reset(),