fix(templates): remove wrong template default parameter for TOptional

This commit is contained in:
Redstone1024 2024-10-30 16:00:39 +08:00
parent 700c901c7b
commit ea3d94f9e2

View File

@ -96,7 +96,7 @@ public:
} }
/** Converting copy constructor. */ /** Converting copy constructor. */
template <typename T = OptionalType> requires (CConstructibleFrom<OptionalType, const T&> && NAMESPACE_PRIVATE::CTOptionalAllowUnwrappable<T, OptionalType>) template <typename T> requires (CConstructibleFrom<OptionalType, const T&> && NAMESPACE_PRIVATE::CTOptionalAllowUnwrappable<T, OptionalType>)
FORCEINLINE constexpr explicit (!CConvertibleTo<const T&, OptionalType>) TOptional(const TOptional<T>& InValue) FORCEINLINE constexpr explicit (!CConvertibleTo<const T&, OptionalType>) TOptional(const TOptional<T>& InValue)
: bIsValid(InValue.IsValid()) : bIsValid(InValue.IsValid())
{ {
@ -104,7 +104,7 @@ public:
} }
/** Converting move constructor. */ /** Converting move constructor. */
template <typename T = OptionalType> requires (CConstructibleFrom<OptionalType, T&&> && NAMESPACE_PRIVATE::CTOptionalAllowUnwrappable<T, OptionalType>) template <typename T> requires (CConstructibleFrom<OptionalType, T&&> && NAMESPACE_PRIVATE::CTOptionalAllowUnwrappable<T, OptionalType>)
FORCEINLINE constexpr explicit (!CConvertibleTo<T&&, OptionalType>) TOptional(TOptional<T>&& InValue) FORCEINLINE constexpr explicit (!CConvertibleTo<T&&, OptionalType>) TOptional(TOptional<T>&& InValue)
: bIsValid(InValue.IsValid()) : bIsValid(InValue.IsValid())
{ {
@ -171,7 +171,7 @@ public:
} }
/** Assigns by copying the state of 'InValue'. */ /** Assigns by copying the state of 'InValue'. */
template <typename T = OptionalType> requires (CConstructibleFrom<OptionalType, const T&> template <typename T> requires (CConstructibleFrom<OptionalType, const T&>
&& CAssignableFrom<OptionalType&, const T&> && NAMESPACE_PRIVATE::CTOptionalAllowUnwrappable<T, OptionalType>) && CAssignableFrom<OptionalType&, const T&> && NAMESPACE_PRIVATE::CTOptionalAllowUnwrappable<T, OptionalType>)
constexpr TOptional& operator=(const TOptional<T>& InValue) constexpr TOptional& operator=(const TOptional<T>& InValue)
{ {
@ -192,7 +192,7 @@ public:
} }
/** Assigns by moving the state of 'InValue'. */ /** Assigns by moving the state of 'InValue'. */
template <typename T = OptionalType> requires (CConstructibleFrom<OptionalType, T&&> template <typename T> requires (CConstructibleFrom<OptionalType, T&&>
&& CAssignableFrom<OptionalType&, T&&> && NAMESPACE_PRIVATE::CTOptionalAllowUnwrappable<T, OptionalType>) && CAssignableFrom<OptionalType&, T&&> && NAMESPACE_PRIVATE::CTOptionalAllowUnwrappable<T, OptionalType>)
constexpr TOptional& operator=(TOptional<T>&& InValue) constexpr TOptional& operator=(TOptional<T>&& InValue)
{ {
@ -227,7 +227,7 @@ public:
} }
/** Check if the two optional are equivalent. */ /** Check if the two optional are equivalent. */
template <typename T = OptionalType> requires (CWeaklyEqualityComparable<OptionalType, T>) template <typename T> requires (CWeaklyEqualityComparable<OptionalType, T>)
NODISCARD friend FORCEINLINE constexpr bool operator==(const TOptional& LHS, const TOptional<T>& RHS) NODISCARD friend FORCEINLINE constexpr bool operator==(const TOptional& LHS, const TOptional<T>& RHS)
{ {
if (LHS.IsValid() != RHS.IsValid()) return false; if (LHS.IsValid() != RHS.IsValid()) return false;
@ -236,7 +236,7 @@ public:
} }
/** Check the order relationship between two optional. */ /** Check the order relationship between two optional. */
template <typename T = OptionalType> requires (CSynthThreeWayComparable<OptionalType, T>) template <typename T> requires (CSynthThreeWayComparable<OptionalType, T>)
NODISCARD friend FORCEINLINE constexpr partial_ordering operator<=>(const TOptional& LHS, const TOptional<T>& RHS) NODISCARD friend FORCEINLINE constexpr partial_ordering operator<=>(const TOptional& LHS, const TOptional<T>& RHS)
{ {
if (LHS.IsValid() != RHS.IsValid()) return partial_ordering::unordered; if (LHS.IsValid() != RHS.IsValid()) return partial_ordering::unordered;
@ -245,14 +245,14 @@ public:
} }
/** Check if the optional value is equivalent to 'InValue'. */ /** Check if the optional value is equivalent to 'InValue'. */
template <typename T = OptionalType> requires (!CTOptional<T> && CWeaklyEqualityComparable<OptionalType, T>) template <typename T> requires (!CTOptional<T> && CWeaklyEqualityComparable<OptionalType, T>)
NODISCARD FORCEINLINE constexpr bool operator==(const T& InValue) const& NODISCARD FORCEINLINE constexpr bool operator==(const T& InValue) const&
{ {
return IsValid() ? GetValue() == InValue : false; return IsValid() ? GetValue() == InValue : false;
} }
/** Check that the optional value is in ordered relationship with 'InValue'. */ /** Check that the optional value is in ordered relationship with 'InValue'. */
template <typename T = OptionalType> requires (!CTOptional<T> && CSynthThreeWayComparable<OptionalType, T>) template <typename T> requires (!CTOptional<T> && CSynthThreeWayComparable<OptionalType, T>)
NODISCARD FORCEINLINE constexpr partial_ordering operator<=>(const T& InValue) const& NODISCARD FORCEINLINE constexpr partial_ordering operator<=>(const T& InValue) const&
{ {
return IsValid() ? SynthThreeWayCompare(GetValue(), InValue) : partial_ordering::unordered; return IsValid() ? SynthThreeWayCompare(GetValue(), InValue) : partial_ordering::unordered;