refactor(typetraits): simplifies concept selection and removes the concept of bitwise operations

This commit is contained in:
2022-05-21 22:39:22 +08:00
parent ee46d84897
commit 97910be70c
14 changed files with 93 additions and 263 deletions

View File

@ -254,7 +254,7 @@ private:
template <typename T>
TOptional(T) -> TOptional<T>;
template <typename T, typename U> requires CWeaklyEqualityComparableWith<T, U>
template <typename T, typename U> requires CWeaklyEqualityComparable<T, U>
constexpr bool operator==(const TOptional<T>& LHS, const TOptional<U>& RHS)
{
if (LHS.IsValid() != RHS.IsValid()) return false;
@ -262,7 +262,7 @@ constexpr bool operator==(const TOptional<T>& LHS, const TOptional<U>& RHS)
return *LHS == *RHS;
}
template <typename T, typename U> requires CSynthThreeWayComparableWith<T, U>
template <typename T, typename U> requires CSynthThreeWayComparable<T, U>
constexpr partial_ordering operator<=>(const TOptional<T>& LHS, const TOptional<U>& RHS)
{
if (LHS.IsValid() != RHS.IsValid()) return partial_ordering::unordered;
@ -270,7 +270,7 @@ constexpr partial_ordering operator<=>(const TOptional<T>& LHS, const TOptional<
return SynthThreeWayCompare(*LHS, *RHS);
}
template <typename T, typename U> requires CWeaklyEqualityComparableWith<T, U>
template <typename T, typename U> requires CWeaklyEqualityComparable<T, U>
constexpr bool operator==(const TOptional<T>& LHS, const U& RHS)
{
return LHS.IsValid() ? *LHS == RHS : false;

View File

@ -557,14 +557,14 @@ constexpr auto TupleCat(TTupleTypes&&... Args)
else return NAMESPACE_PRIVATE::TTupleCatImpl<R>::F(Forward<TTupleTypes>(Args)...);
}
template <typename... LHSTypes, typename... RHSTypes> requires ((sizeof...(LHSTypes) != sizeof...(RHSTypes)) || (true && ... && CWeaklyEqualityComparableWith<LHSTypes, RHSTypes>))
template <typename... LHSTypes, typename... RHSTypes> requires ((sizeof...(LHSTypes) != sizeof...(RHSTypes)) || (true && ... && CWeaklyEqualityComparable<LHSTypes, RHSTypes>))
constexpr bool operator==(const TTuple<LHSTypes...>& LHS, const TTuple<RHSTypes...>& RHS)
{
if constexpr (sizeof...(LHSTypes) != sizeof...(RHSTypes)) return false;
return[&LHS, &RHS]<size_t... Indices>(TIndexSequence<Indices...>) -> bool { return (true && ... && (LHS.template GetValue<Indices>() == RHS.template GetValue<Indices>())); } (TMakeIndexSequence<sizeof...(LHSTypes)>());
}
template <typename... LHSTypes, typename... RHSTypes> requires ((sizeof...(LHSTypes) == sizeof...(RHSTypes)) && (true && ... && (CSynthThreeWayComparableWith<LHSTypes, RHSTypes>)))
template <typename... LHSTypes, typename... RHSTypes> requires ((sizeof...(LHSTypes) == sizeof...(RHSTypes)) && (true && ... && (CSynthThreeWayComparable<LHSTypes, RHSTypes>)))
constexpr typename TCommonComparisonCategory<typename TSynthThreeWayResult<LHSTypes, RHSTypes>::Type...>::Type operator<=>(const TTuple<LHSTypes...>& LHS, const TTuple<RHSTypes...>& RHS)
{
using R = typename TCommonComparisonCategory<typename TSynthThreeWayResult<LHSTypes, RHSTypes>::Type...>::Type;