refactor(typetraits): replaces template class type traits with concepts for TypeTraits/Miscellaneous.h

This commit is contained in:
_Redstone_c_ 2022-05-16 23:09:04 +08:00
parent 413762a90a
commit 6a5a101af4
26 changed files with 529 additions and 524 deletions

View File

@ -53,32 +53,12 @@ NAMESPACE_UNNAMED_END
void TestConcepts() void TestConcepts()
{ {
// Same.h
always_check(!(CSameAs<int32, int64>));
always_check((CSameAs<int32, int32>));
// Derived.h // Derived.h
always_check(!(CDerivedFrom<FTestStructH, FTestStructD>)); always_check(!(CDerivedFrom<FTestStructH, FTestStructD>));
always_check((CDerivedFrom<FTestStructH, FTestStructE>)); always_check((CDerivedFrom<FTestStructH, FTestStructE>));
always_check(!(CDerivedFrom<FTestStructE, FTestStructH>)); always_check(!(CDerivedFrom<FTestStructE, FTestStructH>));
// Convertible.h
always_check((CConvertibleTo<int32, uint32>));
always_check(!(CConvertibleTo<FTestStructH*, FTestStructD*>));
always_check((CConvertibleTo<FTestStructH*, FTestStructE*>));
always_check(!(CConvertibleTo<FTestStructE*, FTestStructH*>));
always_check((CConvertibleTo<FTestStructW, FTestStructV>));
// BooleanTestable.h
always_check(CBooleanTestable<bool>);
always_check(CBooleanTestable<int32>);
always_check(CBooleanTestable<float>);
always_check(!CBooleanTestable<FTestStructA>);
// Common.h // Common.h
always_check((CCommonWith<int32, int32>)); always_check((CCommonWith<int32, int32>));
@ -133,15 +113,6 @@ void TestConcepts()
always_check((CSwappableWith<int32&, int32&>)); always_check((CSwappableWith<int32&, int32&>));
// Invocable.h
always_check((CInvocable <decltype([]( ) -> void { }) >));
always_check((CRegularInvocable <decltype([](int32 A ) -> int32 { return A; }), int32 >));
always_check((CPredicate <decltype([](int32 A, int32 B, int32 C) -> bool { return (A + B + C) == 0; }), int32, int32, int32 >));
always_check((CRelation <decltype([](int32 A, int32 B ) -> bool { return (A ^ B) == 0; }), int32, int32 >));
always_check((CEquivalenceRelation<decltype([](int32 A, int32 B ) -> bool { return A == B; }), int32, int32 >));
always_check((CStrictWeakOrder <decltype([](int32 A, int32 B ) -> bool { return A < B; }), int32, int32 >));
} }
NAMESPACE_END(Testing) NAMESPACE_END(Testing)

View File

@ -185,9 +185,9 @@ void TestCompare()
always_check((FTestStrongOrdering( 0) == FTestStrongOrdering( 0))); always_check((FTestStrongOrdering( 0) == FTestStrongOrdering( 0)));
always_check((FTestStrongOrdering( 0) > FTestStrongOrdering(-1))); always_check((FTestStrongOrdering( 0) > FTestStrongOrdering(-1)));
always_check((TIsSame<TCommonComparisonCategory<strong_ordering >::Type, strong_ordering >::Value)); always_check((CSameAs<TCommonComparisonCategory<strong_ordering >::Type, strong_ordering >));
always_check((TIsSame<TCommonComparisonCategory<strong_ordering, weak_ordering >::Type, weak_ordering >::Value)); always_check((CSameAs<TCommonComparisonCategory<strong_ordering, weak_ordering >::Type, weak_ordering >));
always_check((TIsSame<TCommonComparisonCategory<strong_ordering, weak_ordering, partial_ordering>::Type, partial_ordering>::Value)); always_check((CSameAs<TCommonComparisonCategory<strong_ordering, weak_ordering, partial_ordering>::Type, partial_ordering>));
always_check(CThreeWayComparable<int32>); always_check(CThreeWayComparable<int32>);
always_check(CThreeWayComparable<FTestPartialOrdering>); always_check(CThreeWayComparable<FTestPartialOrdering>);
@ -197,11 +197,11 @@ void TestCompare()
always_check((CThreeWayComparableWith<bool, bool>)); always_check((CThreeWayComparableWith<bool, bool>));
always_check((CThreeWayComparableWith<int16, int32>)); always_check((CThreeWayComparableWith<int16, int32>));
always_check((TIsSame<TCompareThreeWayResult<int32 >::Type, strong_ordering >::Value)); always_check((CSameAs<TCompareThreeWayResult<int32 >::Type, strong_ordering >));
always_check((TIsSame<TCompareThreeWayResult<float >::Type, partial_ordering>::Value)); always_check((CSameAs<TCompareThreeWayResult<float >::Type, partial_ordering>));
always_check((TIsSame<TCompareThreeWayResult<FTestPartialOrdering>::Type, partial_ordering>::Value)); always_check((CSameAs<TCompareThreeWayResult<FTestPartialOrdering>::Type, partial_ordering>));
always_check((TIsSame<TCompareThreeWayResult<FTestWeakOrdering >::Type, weak_ordering >::Value)); always_check((CSameAs<TCompareThreeWayResult<FTestWeakOrdering >::Type, weak_ordering >));
always_check((TIsSame<TCompareThreeWayResult<FTestStrongOrdering >::Type, strong_ordering >::Value)); always_check((CSameAs<TCompareThreeWayResult<FTestStrongOrdering >::Type, strong_ordering >));
always_check((SynthThreeWayCompare(0, 0) == strong_ordering::equal)); always_check((SynthThreeWayCompare(0, 0) == strong_ordering::equal));
always_check((SynthThreeWayCompare(0, 0.0) == strong_ordering::equal)); always_check((SynthThreeWayCompare(0, 0.0) == strong_ordering::equal));

View File

@ -79,8 +79,8 @@ void TestReferenceWrapper()
always_check(ArrayA[1] == 4); always_check(ArrayA[1] == 4);
always_check(ArrayA[2] == 6); always_check(ArrayA[2] == 6);
always_check((TIsSame<int32, TUnwrapRefDecay<int32>::Type>::Value)); always_check((CSameAs<int32, TUnwrapRefDecay<int32>::Type>));
always_check((TIsSame<int32&, TUnwrapRefDecay<TReferenceWrapper<int32>>::Type>::Value)); always_check((CSameAs<int32&, TUnwrapRefDecay<TReferenceWrapper<int32>>::Type>));
} }
void TestOptional() void TestOptional()
@ -255,9 +255,9 @@ void TestVariant()
TempZ = TVariant<FTracker>(); TempZ = TVariant<FTracker>();
TempZ = FTracker(); TempZ = FTracker();
always_check((TIsSame<int32, TVariantAlternativeType<0, TVariant<int32, float>>::Type>::Value)); always_check((CSameAs<int32, TVariantAlternativeType<0, TVariant<int32, float>>::Type>));
always_check((TIsSame<float, TVariantAlternativeType<1, TVariant<int32, float>>::Type>::Value)); always_check((CSameAs<float, TVariantAlternativeType<1, TVariant<int32, float>>::Type>));
always_check((TIsSame<const int32, TVariantAlternativeType<0, const TVariant<int32, float>>::Type>::Value)); always_check((CSameAs<const int32, TVariantAlternativeType<0, const TVariant<int32, float>>::Type>));
always_check((TVariantAlternativeIndex<int32, TVariant<int32, float>>::Value == 0)); always_check((TVariantAlternativeIndex<int32, TVariant<int32, float>>::Value == 0));
always_check((TVariantAlternativeIndex<float, TVariant<int32, float>>::Value == 1)); always_check((TVariantAlternativeIndex<float, TVariant<int32, float>>::Value == 1));
@ -282,7 +282,7 @@ void TestVariant()
TVariant<int32> TempLA = 10; TVariant<int32> TempLA = 10;
auto ReturnLA = TempLA.Visit(TestQualifiers); auto ReturnLA = TempLA.Visit(TestQualifiers);
always_check((TIsSame<int32, decltype(ReturnLA)>::Value)); always_check((CSameAs<int32, decltype(ReturnLA)>));
bIsConst = true; bIsConst = true;
bIsLValue = true; bIsLValue = true;
@ -290,7 +290,7 @@ void TestVariant()
const TVariant<int32> TempLB = TempLA; const TVariant<int32> TempLB = TempLA;
auto ReturnLB = TempLB.Visit(TestQualifiers); auto ReturnLB = TempLB.Visit(TestQualifiers);
always_check((TIsSame<int32, decltype(ReturnLB)>::Value)); always_check((CSameAs<int32, decltype(ReturnLB)>));
bIsConst = false; bIsConst = false;
bIsLValue = false; bIsLValue = false;
@ -298,7 +298,7 @@ void TestVariant()
TVariant<int32> TempRA = 10; TVariant<int32> TempRA = 10;
auto ReturnRA = MoveTemp(TempRA).Visit(TestQualifiers); auto ReturnRA = MoveTemp(TempRA).Visit(TestQualifiers);
always_check((TIsSame<int32, decltype(ReturnRA)>::Value)); always_check((CSameAs<int32, decltype(ReturnRA)>));
bIsConst = true; bIsConst = true;
bIsLValue = false; bIsLValue = false;
@ -306,7 +306,7 @@ void TestVariant()
const TVariant<int32> TempRB = TempLA; const TVariant<int32> TempRB = TempLA;
auto ReturnRB = MoveTemp(TempRB).Visit(TestQualifiers); auto ReturnRB = MoveTemp(TempRB).Visit(TestQualifiers);
always_check((TIsSame<int32, decltype(ReturnRB)>::Value)); always_check((CSameAs<int32, decltype(ReturnRB)>));
bIsConst = false; bIsConst = false;
bIsLValue = true; bIsLValue = true;
@ -314,7 +314,7 @@ void TestVariant()
TVariant<int32> TempLC = 10; TVariant<int32> TempLC = 10;
auto ReturnLC = TempLC.Visit<int32>(TestQualifiers); auto ReturnLC = TempLC.Visit<int32>(TestQualifiers);
always_check((TIsSame<int32, decltype(ReturnLC)>::Value)); always_check((CSameAs<int32, decltype(ReturnLC)>));
bIsConst = true; bIsConst = true;
bIsLValue = true; bIsLValue = true;
@ -322,7 +322,7 @@ void TestVariant()
const TVariant<int32> TempLD = TempLC; const TVariant<int32> TempLD = TempLC;
auto ReturnLD = TempLD.Visit<int32>(TestQualifiers); auto ReturnLD = TempLD.Visit<int32>(TestQualifiers);
always_check((TIsSame<int32, decltype(ReturnLD)>::Value)); always_check((CSameAs<int32, decltype(ReturnLD)>));
bIsConst = false; bIsConst = false;
bIsLValue = false; bIsLValue = false;
@ -330,7 +330,7 @@ void TestVariant()
TVariant<int32> TempRC = 10; TVariant<int32> TempRC = 10;
auto ReturnRC = MoveTemp(TempRC).Visit<int32>(TestQualifiers); auto ReturnRC = MoveTemp(TempRC).Visit<int32>(TestQualifiers);
always_check((TIsSame<int32, decltype(ReturnRC)>::Value)); always_check((CSameAs<int32, decltype(ReturnRC)>));
bIsConst = true; bIsConst = true;
bIsLValue = false; bIsLValue = false;
@ -338,7 +338,7 @@ void TestVariant()
const TVariant<int32> TempRD = TempLC; const TVariant<int32> TempRD = TempLC;
auto ReturnRD = MoveTemp(TempRD).Visit<int32>(TestQualifiers); auto ReturnRD = MoveTemp(TempRD).Visit<int32>(TestQualifiers);
always_check((TIsSame<int32, decltype(ReturnRD)>::Value)); always_check((CSameAs<int32, decltype(ReturnRD)>));
} }
{ {
@ -584,120 +584,120 @@ void TestAny()
void TestTuple() void TestTuple()
{ {
always_check((TIsSame<decltype(DeclVal< TTuple< int32, char>&>().GetValue<0>()), int32&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple< int32, char>&>().GetValue<0>()), int32&>));
always_check((TIsSame<decltype(DeclVal< TTuple<const int32, char>&>().GetValue<0>()), const int32&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple<const int32, char>&>().GetValue<0>()), const int32&>));
always_check((TIsSame<decltype(DeclVal< TTuple< volatile int32, char>&>().GetValue<0>()), volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple< volatile int32, char>&>().GetValue<0>()), volatile int32&>));
always_check((TIsSame<decltype(DeclVal< TTuple<const volatile int32, char>&>().GetValue<0>()), const volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple<const volatile int32, char>&>().GetValue<0>()), const volatile int32&>));
always_check((TIsSame<decltype(DeclVal<const TTuple< int32, char>&>().GetValue<0>()), const int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple< int32, char>&>().GetValue<0>()), const int32&>));
always_check((TIsSame<decltype(DeclVal<const TTuple<const int32, char>&>().GetValue<0>()), const int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple<const int32, char>&>().GetValue<0>()), const int32&>));
always_check((TIsSame<decltype(DeclVal<const TTuple< volatile int32, char>&>().GetValue<0>()), const volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple< volatile int32, char>&>().GetValue<0>()), const volatile int32&>));
always_check((TIsSame<decltype(DeclVal<const TTuple<const volatile int32, char>&>().GetValue<0>()), const volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple<const volatile int32, char>&>().GetValue<0>()), const volatile int32&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple< int32, char>&>().GetValue<0>()), volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple< int32, char>&>().GetValue<0>()), volatile int32&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple<const int32, char>&>().GetValue<0>()), const volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple<const int32, char>&>().GetValue<0>()), const volatile int32&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple< volatile int32, char>&>().GetValue<0>()), volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple< volatile int32, char>&>().GetValue<0>()), volatile int32&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple<const volatile int32, char>&>().GetValue<0>()), const volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple<const volatile int32, char>&>().GetValue<0>()), const volatile int32&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple< int32, char>&>().GetValue<0>()), const volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple< int32, char>&>().GetValue<0>()), const volatile int32&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple<const int32, char>&>().GetValue<0>()), const volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple<const int32, char>&>().GetValue<0>()), const volatile int32&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple< volatile int32, char>&>().GetValue<0>()), const volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple< volatile int32, char>&>().GetValue<0>()), const volatile int32&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple<const volatile int32, char>&>().GetValue<0>()), const volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple<const volatile int32, char>&>().GetValue<0>()), const volatile int32&>));
always_check((TIsSame<decltype(DeclVal< TTuple< int32, char>&&>().GetValue<0>()), int32&&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple< int32, char>&&>().GetValue<0>()), int32&&>));
always_check((TIsSame<decltype(DeclVal< TTuple<const int32, char>&&>().GetValue<0>()), const int32&&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple<const int32, char>&&>().GetValue<0>()), const int32&&>));
always_check((TIsSame<decltype(DeclVal< TTuple< volatile int32, char>&&>().GetValue<0>()), volatile int32&&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple< volatile int32, char>&&>().GetValue<0>()), volatile int32&&>));
always_check((TIsSame<decltype(DeclVal< TTuple<const volatile int32, char>&&>().GetValue<0>()), const volatile int32&&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple<const volatile int32, char>&&>().GetValue<0>()), const volatile int32&&>));
always_check((TIsSame<decltype(DeclVal<const TTuple< int32, char>&&>().GetValue<0>()), const int32&&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple< int32, char>&&>().GetValue<0>()), const int32&&>));
always_check((TIsSame<decltype(DeclVal<const TTuple<const int32, char>&&>().GetValue<0>()), const int32&&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple<const int32, char>&&>().GetValue<0>()), const int32&&>));
always_check((TIsSame<decltype(DeclVal<const TTuple< volatile int32, char>&&>().GetValue<0>()), const volatile int32&&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple< volatile int32, char>&&>().GetValue<0>()), const volatile int32&&>));
always_check((TIsSame<decltype(DeclVal<const TTuple<const volatile int32, char>&&>().GetValue<0>()), const volatile int32&&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple<const volatile int32, char>&&>().GetValue<0>()), const volatile int32&&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple< int32, char>&&>().GetValue<0>()), volatile int32&&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple< int32, char>&&>().GetValue<0>()), volatile int32&&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple<const int32, char>&&>().GetValue<0>()), const volatile int32&&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple<const int32, char>&&>().GetValue<0>()), const volatile int32&&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple< volatile int32, char>&&>().GetValue<0>()), volatile int32&&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple< volatile int32, char>&&>().GetValue<0>()), volatile int32&&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple<const volatile int32, char>&&>().GetValue<0>()), const volatile int32&&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple<const volatile int32, char>&&>().GetValue<0>()), const volatile int32&&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple< int32, char>&&>().GetValue<0>()), const volatile int32&&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple< int32, char>&&>().GetValue<0>()), const volatile int32&&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple<const int32, char>&&>().GetValue<0>()), const volatile int32&&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple<const int32, char>&&>().GetValue<0>()), const volatile int32&&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple< volatile int32, char>&&>().GetValue<0>()), const volatile int32&&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple< volatile int32, char>&&>().GetValue<0>()), const volatile int32&&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple<const volatile int32, char>&&>().GetValue<0>()), const volatile int32&&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple<const volatile int32, char>&&>().GetValue<0>()), const volatile int32&&>));
always_check((TIsSame<decltype(DeclVal< TTuple< int32&, char>&>().GetValue<0>()), int32&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple< int32&, char>&>().GetValue<0>()), int32&>));
always_check((TIsSame<decltype(DeclVal< TTuple<const int32&, char>&>().GetValue<0>()), const int32&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple<const int32&, char>&>().GetValue<0>()), const int32&>));
always_check((TIsSame<decltype(DeclVal< TTuple< volatile int32&, char>&>().GetValue<0>()), volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple< volatile int32&, char>&>().GetValue<0>()), volatile int32&>));
always_check((TIsSame<decltype(DeclVal< TTuple<const volatile int32&, char>&>().GetValue<0>()), const volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple<const volatile int32&, char>&>().GetValue<0>()), const volatile int32&>));
always_check((TIsSame<decltype(DeclVal<const TTuple< int32&, char>&>().GetValue<0>()), int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple< int32&, char>&>().GetValue<0>()), int32&>));
always_check((TIsSame<decltype(DeclVal<const TTuple<const int32&, char>&>().GetValue<0>()), const int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple<const int32&, char>&>().GetValue<0>()), const int32&>));
always_check((TIsSame<decltype(DeclVal<const TTuple< volatile int32&, char>&>().GetValue<0>()), volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple< volatile int32&, char>&>().GetValue<0>()), volatile int32&>));
always_check((TIsSame<decltype(DeclVal<const TTuple<const volatile int32&, char>&>().GetValue<0>()), const volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple<const volatile int32&, char>&>().GetValue<0>()), const volatile int32&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple< int32&, char>&>().GetValue<0>()), int32&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple< int32&, char>&>().GetValue<0>()), int32&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple<const int32&, char>&>().GetValue<0>()), const int32&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple<const int32&, char>&>().GetValue<0>()), const int32&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple< volatile int32&, char>&>().GetValue<0>()), volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple< volatile int32&, char>&>().GetValue<0>()), volatile int32&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple<const volatile int32&, char>&>().GetValue<0>()), const volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple<const volatile int32&, char>&>().GetValue<0>()), const volatile int32&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple< int32&, char>&>().GetValue<0>()), int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple< int32&, char>&>().GetValue<0>()), int32&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple<const int32&, char>&>().GetValue<0>()), const int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple<const int32&, char>&>().GetValue<0>()), const int32&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple< volatile int32&, char>&>().GetValue<0>()), volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple< volatile int32&, char>&>().GetValue<0>()), volatile int32&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple<const volatile int32&, char>&>().GetValue<0>()), const volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple<const volatile int32&, char>&>().GetValue<0>()), const volatile int32&>));
always_check((TIsSame<decltype(DeclVal< TTuple< int32&, char>&&>().GetValue<0>()), int32&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple< int32&, char>&&>().GetValue<0>()), int32&>));
always_check((TIsSame<decltype(DeclVal< TTuple<const int32&, char>&&>().GetValue<0>()), const int32&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple<const int32&, char>&&>().GetValue<0>()), const int32&>));
always_check((TIsSame<decltype(DeclVal< TTuple< volatile int32&, char>&&>().GetValue<0>()), volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple< volatile int32&, char>&&>().GetValue<0>()), volatile int32&>));
always_check((TIsSame<decltype(DeclVal< TTuple<const volatile int32&, char>&&>().GetValue<0>()), const volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple<const volatile int32&, char>&&>().GetValue<0>()), const volatile int32&>));
always_check((TIsSame<decltype(DeclVal<const TTuple< int32&, char>&&>().GetValue<0>()), int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple< int32&, char>&&>().GetValue<0>()), int32&>));
always_check((TIsSame<decltype(DeclVal<const TTuple<const int32&, char>&&>().GetValue<0>()), const int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple<const int32&, char>&&>().GetValue<0>()), const int32&>));
always_check((TIsSame<decltype(DeclVal<const TTuple< volatile int32&, char>&&>().GetValue<0>()), volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple< volatile int32&, char>&&>().GetValue<0>()), volatile int32&>));
always_check((TIsSame<decltype(DeclVal<const TTuple<const volatile int32&, char>&&>().GetValue<0>()), const volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple<const volatile int32&, char>&&>().GetValue<0>()), const volatile int32&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple< int32&, char>&&>().GetValue<0>()), int32&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple< int32&, char>&&>().GetValue<0>()), int32&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple<const int32&, char>&&>().GetValue<0>()), const int32&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple<const int32&, char>&&>().GetValue<0>()), const int32&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple< volatile int32&, char>&&>().GetValue<0>()), volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple< volatile int32&, char>&&>().GetValue<0>()), volatile int32&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple<const volatile int32&, char>&&>().GetValue<0>()), const volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple<const volatile int32&, char>&&>().GetValue<0>()), const volatile int32&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple< int32&, char>&&>().GetValue<0>()), int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple< int32&, char>&&>().GetValue<0>()), int32&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple<const int32&, char>&&>().GetValue<0>()), const int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple<const int32&, char>&&>().GetValue<0>()), const int32&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple< volatile int32&, char>&&>().GetValue<0>()), volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple< volatile int32&, char>&&>().GetValue<0>()), volatile int32&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple<const volatile int32&, char>&&>().GetValue<0>()), const volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple<const volatile int32&, char>&&>().GetValue<0>()), const volatile int32&>));
always_check((TIsSame<decltype(DeclVal< TTuple< int32&&, char>&>().GetValue<0>()), int32&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple< int32&&, char>&>().GetValue<0>()), int32&>));
always_check((TIsSame<decltype(DeclVal< TTuple<const int32&&, char>&>().GetValue<0>()), const int32&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple<const int32&&, char>&>().GetValue<0>()), const int32&>));
always_check((TIsSame<decltype(DeclVal< TTuple< volatile int32&&, char>&>().GetValue<0>()), volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple< volatile int32&&, char>&>().GetValue<0>()), volatile int32&>));
always_check((TIsSame<decltype(DeclVal< TTuple<const volatile int32&&, char>&>().GetValue<0>()), const volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple<const volatile int32&&, char>&>().GetValue<0>()), const volatile int32&>));
always_check((TIsSame<decltype(DeclVal<const TTuple< int32&&, char>&>().GetValue<0>()), int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple< int32&&, char>&>().GetValue<0>()), int32&>));
always_check((TIsSame<decltype(DeclVal<const TTuple<const int32&&, char>&>().GetValue<0>()), const int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple<const int32&&, char>&>().GetValue<0>()), const int32&>));
always_check((TIsSame<decltype(DeclVal<const TTuple< volatile int32&&, char>&>().GetValue<0>()), volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple< volatile int32&&, char>&>().GetValue<0>()), volatile int32&>));
always_check((TIsSame<decltype(DeclVal<const TTuple<const volatile int32&&, char>&>().GetValue<0>()), const volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple<const volatile int32&&, char>&>().GetValue<0>()), const volatile int32&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple< int32&&, char>&>().GetValue<0>()), int32&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple< int32&&, char>&>().GetValue<0>()), int32&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple<const int32&&, char>&>().GetValue<0>()), const int32&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple<const int32&&, char>&>().GetValue<0>()), const int32&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple< volatile int32&&, char>&>().GetValue<0>()), volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple< volatile int32&&, char>&>().GetValue<0>()), volatile int32&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple<const volatile int32&&, char>&>().GetValue<0>()), const volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple<const volatile int32&&, char>&>().GetValue<0>()), const volatile int32&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple< int32&&, char>&>().GetValue<0>()), int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple< int32&&, char>&>().GetValue<0>()), int32&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple<const int32&&, char>&>().GetValue<0>()), const int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple<const int32&&, char>&>().GetValue<0>()), const int32&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple< volatile int32&&, char>&>().GetValue<0>()), volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple< volatile int32&&, char>&>().GetValue<0>()), volatile int32&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple<const volatile int32&&, char>&>().GetValue<0>()), const volatile int32&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple<const volatile int32&&, char>&>().GetValue<0>()), const volatile int32&>));
always_check((TIsSame<decltype(DeclVal< TTuple< int32&&, char>&&>().GetValue<0>()), int32&&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple< int32&&, char>&&>().GetValue<0>()), int32&&>));
always_check((TIsSame<decltype(DeclVal< TTuple<const int32&&, char>&&>().GetValue<0>()), const int32&&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple<const int32&&, char>&&>().GetValue<0>()), const int32&&>));
always_check((TIsSame<decltype(DeclVal< TTuple< volatile int32&&, char>&&>().GetValue<0>()), volatile int32&&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple< volatile int32&&, char>&&>().GetValue<0>()), volatile int32&&>));
always_check((TIsSame<decltype(DeclVal< TTuple<const volatile int32&&, char>&&>().GetValue<0>()), const volatile int32&&>::Value)); always_check((CSameAs<decltype(DeclVal< TTuple<const volatile int32&&, char>&&>().GetValue<0>()), const volatile int32&&>));
always_check((TIsSame<decltype(DeclVal<const TTuple< int32&&, char>&&>().GetValue<0>()), int32&&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple< int32&&, char>&&>().GetValue<0>()), int32&&>));
always_check((TIsSame<decltype(DeclVal<const TTuple<const int32&&, char>&&>().GetValue<0>()), const int32&&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple<const int32&&, char>&&>().GetValue<0>()), const int32&&>));
always_check((TIsSame<decltype(DeclVal<const TTuple< volatile int32&&, char>&&>().GetValue<0>()), volatile int32&&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple< volatile int32&&, char>&&>().GetValue<0>()), volatile int32&&>));
always_check((TIsSame<decltype(DeclVal<const TTuple<const volatile int32&&, char>&&>().GetValue<0>()), const volatile int32&&>::Value)); always_check((CSameAs<decltype(DeclVal<const TTuple<const volatile int32&&, char>&&>().GetValue<0>()), const volatile int32&&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple< int32&&, char>&&>().GetValue<0>()), int32&&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple< int32&&, char>&&>().GetValue<0>()), int32&&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple<const int32&&, char>&&>().GetValue<0>()), const int32&&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple<const int32&&, char>&&>().GetValue<0>()), const int32&&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple< volatile int32&&, char>&&>().GetValue<0>()), volatile int32&&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple< volatile int32&&, char>&&>().GetValue<0>()), volatile int32&&>));
always_check((TIsSame<decltype(DeclVal< volatile TTuple<const volatile int32&&, char>&&>().GetValue<0>()), const volatile int32&&>::Value)); always_check((CSameAs<decltype(DeclVal< volatile TTuple<const volatile int32&&, char>&&>().GetValue<0>()), const volatile int32&&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple< int32&&, char>&&>().GetValue<0>()), int32&&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple< int32&&, char>&&>().GetValue<0>()), int32&&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple<const int32&&, char>&&>().GetValue<0>()), const int32&&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple<const int32&&, char>&&>().GetValue<0>()), const int32&&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple< volatile int32&&, char>&&>().GetValue<0>()), volatile int32&&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple< volatile int32&&, char>&&>().GetValue<0>()), volatile int32&&>));
always_check((TIsSame<decltype(DeclVal<const volatile TTuple<const volatile int32&&, char>&&>().GetValue<0>()), const volatile int32&&>::Value)); always_check((CSameAs<decltype(DeclVal<const volatile TTuple<const volatile int32&&, char>&&>().GetValue<0>()), const volatile int32&&>));
always_check((TIsSame<TTupleElementType<0, TTuple<double, float&, char&&>>::Type, double>::Value)); always_check((CSameAs<TTupleElementType<0, TTuple<double, float&, char&&>>::Type, double>));
always_check((TIsSame<TTupleElementType<1, TTuple<double, float&, char&&>>::Type, float&>::Value)); always_check((CSameAs<TTupleElementType<1, TTuple<double, float&, char&&>>::Type, float&>));
always_check((TIsSame<TTupleElementType<2, TTuple<double, float&, char&&>>::Type, char&&>::Value)); always_check((CSameAs<TTupleElementType<2, TTuple<double, float&, char&&>>::Type, char&&>));
always_check((TIsSame<TTupleElementType<0, const TTuple<double, float&, char&&>>::Type, const double>::Value)); always_check((CSameAs<TTupleElementType<0, const TTuple<double, float&, char&&>>::Type, const double>));
always_check((TIsSame<TTupleElementType<1, const TTuple<double, float&, char&&>>::Type, const float&>::Value)); always_check((CSameAs<TTupleElementType<1, const TTuple<double, float&, char&&>>::Type, const float&>));
always_check((TIsSame<TTupleElementType<2, const TTuple<double, float&, char&&>>::Type, const char&&>::Value)); always_check((CSameAs<TTupleElementType<2, const TTuple<double, float&, char&&>>::Type, const char&&>));
always_check((TIsSame<TTupleElementType<0, volatile TTuple<double, float&, char&&>>::Type, volatile double>::Value)); always_check((CSameAs<TTupleElementType<0, volatile TTuple<double, float&, char&&>>::Type, volatile double>));
always_check((TIsSame<TTupleElementType<1, volatile TTuple<double, float&, char&&>>::Type, volatile float&>::Value)); always_check((CSameAs<TTupleElementType<1, volatile TTuple<double, float&, char&&>>::Type, volatile float&>));
always_check((TIsSame<TTupleElementType<2, volatile TTuple<double, float&, char&&>>::Type, volatile char&&>::Value)); always_check((CSameAs<TTupleElementType<2, volatile TTuple<double, float&, char&&>>::Type, volatile char&&>));
always_check((TIsSame<TTupleElementType<0, const volatile TTuple<double, float&, char&&>>::Type, const volatile double>::Value)); always_check((CSameAs<TTupleElementType<0, const volatile TTuple<double, float&, char&&>>::Type, const volatile double>));
always_check((TIsSame<TTupleElementType<1, const volatile TTuple<double, float&, char&&>>::Type, const volatile float&>::Value)); always_check((CSameAs<TTupleElementType<1, const volatile TTuple<double, float&, char&&>>::Type, const volatile float&>));
always_check((TIsSame<TTupleElementType<2, const volatile TTuple<double, float&, char&&>>::Type, const volatile char&&>::Value)); always_check((CSameAs<TTupleElementType<2, const volatile TTuple<double, float&, char&&>>::Type, const volatile char&&>));
always_check((TTupleElementIndex<double, TTuple<double, float&, char&&>>::Value == 0)); always_check((TTupleElementIndex<double, TTuple<double, float&, char&&>>::Value == 0));
always_check((TTupleElementIndex<float&, TTuple<double, float&, char&&>>::Value == 1)); always_check((TTupleElementIndex<float&, TTuple<double, float&, char&&>>::Value == 1));
@ -714,11 +714,11 @@ void TestTuple()
always_check((TTupleElementIndex<int32, TTuple<double, float&, char&&>>::Value == INDEX_NONE)); always_check((TTupleElementIndex<int32, TTuple<double, float&, char&&>>::Value == INDEX_NONE));
// always_check((TIsSame<TTupleElementType<0, int32>::Type, double>::Value)); // always_check((CSameAs<TTupleElementType<0, int32>::Type, double>));
// always_check((TTupleElementIndex<int32, int32>::Value == 0)); // always_check((TTupleElementIndex<int32, int32>::Value == 0));
// always_check((TIsSame<TTupleElementType<4, TTuple<double, float&, char&&>>::Type, double>::Value)); // always_check((CSameAs<TTupleElementType<4, TTuple<double, float&, char&&>>::Type, double>));
{ {
using Type = TTuple<int8, uint8, int16, uint16, int32, uint32, int64, uint64, int8, uint8, int16, uint16, int32, uint32, int64, uint64, using Type = TTuple<int8, uint8, int16, uint16, int32, uint32, int64, uint64, int8, uint8, int16, uint16, int32, uint32, int64, uint64,
@ -801,8 +801,8 @@ void TestTuple()
always_check(TempE.GetValue<int32>() == 404); always_check(TempE.GetValue<int32>() == 404);
always_check(TempE.GetValue<double>() == 3.14); always_check(TempE.GetValue<double>() == 3.14);
always_check(TempE.GetValue<float>() == 1.42f); always_check(TempE.GetValue<float>() == 1.42f);
always_check((TIsSame<decltype(TempE), TTuple<int32, FTracker, double, FTracker, float, FTracker>>::Value)); always_check((CSameAs<decltype(TempE), TTuple<int32, FTracker, double, FTracker, float, FTracker>>));
always_check((TIsSame<decltype(TempE), typename TTupleCatResult<TTuple<int32, FTracker>, TTuple<double, FTracker>, TTuple<float, FTracker>>::Type>::Value)); always_check((CSameAs<decltype(TempE), typename TTupleCatResult<TTuple<int32, FTracker>, TTuple<double, FTracker>, TTuple<float, FTracker>>::Type>));
} }
{ {
@ -826,8 +826,8 @@ void TestTuple()
always_check(TempB == 3.14); always_check(TempB == 3.14);
always_check(TempG.GetValue<0>() == 10); always_check(TempG.GetValue<0>() == 10);
always_check(TempG.GetValue<2>() == 10); always_check(TempG.GetValue<2>() == 10);
always_check((TIsSame<decltype(TempG), TTuple<int32, double&, int16&, FTracker&&>>::Value)); always_check((CSameAs<decltype(TempG), TTuple<int32, double&, int16&, FTracker&&>>));
always_check((TIsSame<decltype(TempG), typename TTupleCatResult<TTuple<int32, double&>, TTuple<int16&, FTracker&&>>::Type>::Value)); always_check((CSameAs<decltype(TempG), typename TTupleCatResult<TTuple<int32, double&>, TTuple<int16&, FTracker&&>>::Type>));
} }
{ {
@ -839,8 +839,8 @@ void TestTuple()
{ {
always_check(A == 15); always_check(A == 15);
always_check(B == 514); always_check(B == 514);
always_check((TIsSame<T&&, int32&>::Value)); always_check((CSameAs<T&&, int32&>));
always_check((TIsSame<U&&, const int64&>::Value)); always_check((CSameAs<U&&, const int64&>));
} }
); );
@ -849,8 +849,8 @@ void TestTuple()
{ {
always_check(A == 15); always_check(A == 15);
always_check(B == 514); always_check(B == 514);
always_check((TIsSame<T&&, int32&&>::Value)); always_check((CSameAs<T&&, int32&&>));
always_check((TIsSame<U&&, const int64&&>::Value)); always_check((CSameAs<U&&, const int64&&>));
} }
); );
@ -860,9 +860,9 @@ void TestTuple()
always_check(A == '-'); always_check(A == '-');
always_check(B == 15); always_check(B == 15);
always_check(C == 514); always_check(C == 514);
always_check((TIsSame<T&&, char&&>::Value)); always_check((CSameAs<T&&, char&&>));
always_check((TIsSame<U&&, int32&>::Value)); always_check((CSameAs<U&&, int32&>));
always_check((TIsSame<V&&, const int64&>::Value)); always_check((CSameAs<V&&, const int64&>));
}, },
'-' '-'
); );
@ -873,9 +873,9 @@ void TestTuple()
always_check(A == '-'); always_check(A == '-');
always_check(B == 15); always_check(B == 15);
always_check(C == 514); always_check(C == 514);
always_check((TIsSame<T&&, char&&>::Value)); always_check((CSameAs<T&&, char&&>));
always_check((TIsSame<U&&, int32&&>::Value)); always_check((CSameAs<U&&, int32&&>));
always_check((TIsSame<V&&, const int64&&>::Value)); always_check((CSameAs<V&&, const int64&&>));
}, },
'-' '-'
); );
@ -886,9 +886,9 @@ void TestTuple()
always_check(A == 15); always_check(A == 15);
always_check(B == 514); always_check(B == 514);
always_check(C == '-'); always_check(C == '-');
always_check((TIsSame<T&&, int32&>::Value)); always_check((CSameAs<T&&, int32&>));
always_check((TIsSame<U&&, const int64&>::Value)); always_check((CSameAs<U&&, const int64&>));
always_check((TIsSame<V&&, char&&>::Value)); always_check((CSameAs<V&&, char&&>));
}, },
'-' '-'
); );
@ -899,9 +899,9 @@ void TestTuple()
always_check(A == 15); always_check(A == 15);
always_check(B == 514); always_check(B == 514);
always_check(C == '-'); always_check(C == '-');
always_check((TIsSame<T&&, int32&&>::Value)); always_check((CSameAs<T&&, int32&&>));
always_check((TIsSame<U&&, const int64&&>::Value)); always_check((CSameAs<U&&, const int64&&>));
always_check((TIsSame<V&&, char&&>::Value)); always_check((CSameAs<V&&, char&&>));
}, },
'-' '-'
); );
@ -914,8 +914,8 @@ void TestTuple()
VisitTuple( VisitTuple(
[]<typename T> (T&& A) []<typename T> (T&& A)
{ {
if constexpr (TIsSame<T&&, int32&>::Value) always_check(A == 2); if constexpr (CSameAs<T&&, int32&>) always_check(A == 2);
else if constexpr (TIsSame<T&&, char&>::Value) always_check(A == 'B'); else if constexpr (CSameAs<T&&, char&>) always_check(A == 'B');
else always_check_no_entry(); else always_check_no_entry();
}, },
TempB TempB
@ -926,8 +926,8 @@ void TestTuple()
VisitTuple( VisitTuple(
[]<typename T> (T&& A) []<typename T> (T&& A)
{ {
if constexpr (TIsSame<T&&, int32&>::Value) always_check(A == 3); if constexpr (CSameAs<T&&, int32&>) always_check(A == 3);
else if constexpr (TIsSame<T&&, char&>::Value) always_check(A == 'C'); else if constexpr (CSameAs<T&&, char&>) always_check(A == 'C');
else always_check_no_entry(); else always_check_no_entry();
}, },
TempB TempB
@ -953,7 +953,7 @@ void TestTuple()
always_check(A == 1); always_check(A == 1);
always_check(B == 2.3); always_check(B == 2.3);
always_check(C == 'A'); always_check(C == 'A');
always_check((TIsSame<decltype(C), char>::Value)); always_check((CSameAs<decltype(C), char>));
} }
always_check(GetTypeHash(MakeTuple(114, 1.0f)) == GetTypeHash(MakeTuple(114, 1.0f))); always_check(GetTypeHash(MakeTuple(114, 1.0f)) == GetTypeHash(MakeTuple(114, 1.0f)));

View File

@ -301,105 +301,94 @@ void TestTypeTraits()
// Miscellaneous.h // Miscellaneous.h
always_check(TRank<int32[1][2][3]>::Value == 3); always_check(ArrayRank<int32[1][2][3]> == 3);
always_check(TRank<int32[1][2][3][4]>::Value == 4); always_check(ArrayRank<int32[1][2][3][4]> == 4);
always_check(TRank<int32>::Value == 0); always_check(ArrayRank<int32> == 0);
always_check(TExtent<int32[1][2][3]>::Value == 1); always_check(ArrayExtent<int32[1][2][3]> == 1);
always_check((TExtent<int32[1][2][3][4], 1>::Value == 2)); always_check((ArrayExtent<int32[1][2][3][4], 1> == 2));
always_check(TExtent<int32[]>::Value == 0); always_check(ArrayExtent<int32[]> == 0);
always_check(!(TIsSame<int32, int64>::Value)); always_check(!(CSameAs<int32, int64>));
always_check((TIsSame<int32, int32>::Value)); always_check((CSameAs<int32, int32>));
always_check(!(TIsBaseOf<FTestStructH, FTestStructD>::Value)); always_check(!(CBaseOf<FTestStructH, FTestStructD>));
always_check(!(TIsBaseOf<FTestStructH, FTestStructE>::Value)); always_check(!(CBaseOf<FTestStructH, FTestStructE>));
always_check((TIsBaseOf<FTestStructE, FTestStructH>::Value)); always_check((CBaseOf<FTestStructE, FTestStructH>));
always_check((TIsConvertible<int32, uint32>::Value)); always_check((CConvertibleTo<int32, uint32>));
always_check(!(TIsConvertible<FTestStructH*, FTestStructD*>::Value)); always_check(!(CConvertibleTo<FTestStructH*, FTestStructD*>));
always_check((TIsConvertible<FTestStructH*, FTestStructE*>::Value)); always_check((CConvertibleTo<FTestStructH*, FTestStructE*>));
always_check(!(TIsConvertible<FTestStructE*, FTestStructH*>::Value)); always_check(!(CConvertibleTo<FTestStructE*, FTestStructH*>));
always_check((TIsConvertible<FTestStructW, FTestStructV>::Value)); always_check((CConvertibleTo<FTestStructW, FTestStructV>));
always_check((TIsInvocable<int32()>::Value)); always_check((CSameAs<int32, TRemoveConst<int32>::Type>));
always_check((TIsInvocable<int32(int32), int32>::Value)); always_check(!(CSameAs<int32, TRemoveConst<int32*>::Type>));
always_check(!(TIsInvocable<int32(int32), FTestStructA>::Value)); always_check(!(CSameAs<int32, TRemoveConst<int32&>::Type>));
always_check((TIsInvocable<int32(int32), int32>::Value)); always_check(!(CSameAs<int32, TRemoveConst<int32&&>::Type>));
always_check((CSameAs<int32, TRemoveConst<const int32>::Type>));
always_check(!(CSameAs<int32, TRemoveConst<volatile int32>::Type>));
always_check(!(CSameAs<int32, TRemoveConst<const volatile int32>::Type>));
always_check(!(CSameAs<int32, TRemoveConst<const volatile int32&>::Type>));
always_check((TIsInvocableResult<void, int32()>::Value)); always_check((CSameAs<int32, TRemoveVolatile<int32>::Type>));
always_check((TIsInvocableResult<int32, int32()>::Value)); always_check(!(CSameAs<int32, TRemoveVolatile<int32*>::Type>));
always_check((TIsInvocableResult<int32, int32(int32), int32>::Value)); always_check(!(CSameAs<int32, TRemoveVolatile<int32&>::Type>));
always_check(!(TIsInvocableResult<int32, int32(int32), FTestStructA>::Value)); always_check(!(CSameAs<int32, TRemoveVolatile<int32&&>::Type>));
always_check(!(TIsInvocableResult<FTestStructA, int32(int32), int32>::Value)); always_check(!(CSameAs<int32, TRemoveVolatile<const int32>::Type>));
always_check((CSameAs<int32, TRemoveVolatile<volatile int32>::Type>));
always_check(!(CSameAs<int32, TRemoveVolatile<const volatile int32>::Type>));
always_check(!(CSameAs<int32, TRemoveVolatile<const volatile int32&>::Type>));
always_check((TIsSame<int32, TRemoveConst<int32>::Type>::Value)); always_check((CSameAs<int32, TRemoveCV<int32>::Type>));
always_check(!(TIsSame<int32, TRemoveConst<int32*>::Type>::Value)); always_check(!(CSameAs<int32, TRemoveCV<int32*>::Type>));
always_check(!(TIsSame<int32, TRemoveConst<int32&>::Type>::Value)); always_check(!(CSameAs<int32, TRemoveCV<int32&>::Type>));
always_check(!(TIsSame<int32, TRemoveConst<int32&&>::Type>::Value)); always_check(!(CSameAs<int32, TRemoveCV<int32&&>::Type>));
always_check((TIsSame<int32, TRemoveConst<const int32>::Type>::Value)); always_check((CSameAs<int32, TRemoveCV<const int32>::Type>));
always_check(!(TIsSame<int32, TRemoveConst<volatile int32>::Type>::Value)); always_check((CSameAs<int32, TRemoveCV<volatile int32>::Type>));
always_check(!(TIsSame<int32, TRemoveConst<const volatile int32>::Type>::Value)); always_check((CSameAs<int32, TRemoveCV<const volatile int32>::Type>));
always_check(!(TIsSame<int32, TRemoveConst<const volatile int32&>::Type>::Value)); always_check(!(CSameAs<int32, TRemoveCV<const volatile int32&>::Type>));
always_check((TIsSame<int32, TRemoveVolatile<int32>::Type>::Value)); always_check((CSameAs<int32, TRemovePointer<int32>::Type>));
always_check(!(TIsSame<int32, TRemoveVolatile<int32*>::Type>::Value)); always_check((CSameAs<int32, TRemovePointer<int32*>::Type>));
always_check(!(TIsSame<int32, TRemoveVolatile<int32&>::Type>::Value)); always_check(!(CSameAs<int32, TRemovePointer<int32&>::Type>));
always_check(!(TIsSame<int32, TRemoveVolatile<int32&&>::Type>::Value)); always_check(!(CSameAs<int32, TRemovePointer<int32&&>::Type>));
always_check(!(TIsSame<int32, TRemoveVolatile<const int32>::Type>::Value)); always_check(!(CSameAs<int32, TRemovePointer<const int32>::Type>));
always_check((TIsSame<int32, TRemoveVolatile<volatile int32>::Type>::Value)); always_check(!(CSameAs<int32, TRemovePointer<volatile int32>::Type>));
always_check(!(TIsSame<int32, TRemoveVolatile<const volatile int32>::Type>::Value)); always_check(!(CSameAs<int32, TRemovePointer<const volatile int32>::Type>));
always_check(!(TIsSame<int32, TRemoveVolatile<const volatile int32&>::Type>::Value)); always_check(!(CSameAs<int32, TRemovePointer<const volatile int32&>::Type>));
always_check((TIsSame<int32, TRemoveCV<int32>::Type>::Value)); always_check((CSameAs<int32, TRemoveReference<int32>::Type>));
always_check(!(TIsSame<int32, TRemoveCV<int32*>::Type>::Value)); always_check(!(CSameAs<int32, TRemoveReference<int32*>::Type>));
always_check(!(TIsSame<int32, TRemoveCV<int32&>::Type>::Value)); always_check((CSameAs<int32, TRemoveReference<int32&>::Type>));
always_check(!(TIsSame<int32, TRemoveCV<int32&&>::Type>::Value)); always_check((CSameAs<int32, TRemoveReference<int32&&>::Type>));
always_check((TIsSame<int32, TRemoveCV<const int32>::Type>::Value)); always_check(!(CSameAs<int32, TRemoveReference<const int32>::Type>));
always_check((TIsSame<int32, TRemoveCV<volatile int32>::Type>::Value)); always_check(!(CSameAs<int32, TRemoveReference<volatile int32>::Type>));
always_check((TIsSame<int32, TRemoveCV<const volatile int32>::Type>::Value)); always_check(!(CSameAs<int32, TRemoveReference<const volatile int32>::Type>));
always_check(!(TIsSame<int32, TRemoveCV<const volatile int32&>::Type>::Value)); always_check(!(CSameAs<int32, TRemoveReference<const volatile int32&>::Type>));
always_check((TIsSame<int32, TRemovePointer<int32>::Type>::Value)); always_check((CSameAs<int32, TRemoveCVRef<int32>::Type>));
always_check((TIsSame<int32, TRemovePointer<int32*>::Type>::Value)); always_check(!(CSameAs<int32, TRemoveCVRef<int32*>::Type>));
always_check(!(TIsSame<int32, TRemovePointer<int32&>::Type>::Value)); always_check((CSameAs<int32, TRemoveCVRef<int32&>::Type>));
always_check(!(TIsSame<int32, TRemovePointer<int32&&>::Type>::Value)); always_check((CSameAs<int32, TRemoveCVRef<int32&&>::Type>));
always_check(!(TIsSame<int32, TRemovePointer<const int32>::Type>::Value)); always_check((CSameAs<int32, TRemoveCVRef<const int32>::Type>));
always_check(!(TIsSame<int32, TRemovePointer<volatile int32>::Type>::Value)); always_check((CSameAs<int32, TRemoveCVRef<volatile int32>::Type>));
always_check(!(TIsSame<int32, TRemovePointer<const volatile int32>::Type>::Value)); always_check((CSameAs<int32, TRemoveCVRef<const volatile int32>::Type>));
always_check(!(TIsSame<int32, TRemovePointer<const volatile int32&>::Type>::Value)); always_check((CSameAs<int32, TRemoveCVRef<const volatile int32&>::Type>));
always_check((TIsSame<int32, TRemoveReference<int32>::Type>::Value)); always_check((CSameAs<int32, TRemoveExtent<int32[1]>::Type>));
always_check(!(TIsSame<int32, TRemoveReference<int32*>::Type>::Value)); always_check(!(CSameAs<int32, TRemoveExtent<int32[1][2]>::Type>));
always_check((TIsSame<int32, TRemoveReference<int32&>::Type>::Value)); always_check((CSameAs<int32[2][3], TRemoveExtent<int32[1][2][3]>::Type>));
always_check((TIsSame<int32, TRemoveReference<int32&&>::Type>::Value));
always_check(!(TIsSame<int32, TRemoveReference<const int32>::Type>::Value));
always_check(!(TIsSame<int32, TRemoveReference<volatile int32>::Type>::Value));
always_check(!(TIsSame<int32, TRemoveReference<const volatile int32>::Type>::Value));
always_check(!(TIsSame<int32, TRemoveReference<const volatile int32&>::Type>::Value));
always_check((TIsSame<int32, TRemoveCVRef<int32>::Type>::Value)); always_check((CSameAs<int32, TRemoveAllExtents<int32[1]>::Type>));
always_check(!(TIsSame<int32, TRemoveCVRef<int32*>::Type>::Value)); always_check((CSameAs<int32, TRemoveAllExtents<int32[1][2]>::Type>));
always_check((TIsSame<int32, TRemoveCVRef<int32&>::Type>::Value)); always_check((CSameAs<int32, TRemoveAllExtents<int32[1][2][3]>::Type>));
always_check((TIsSame<int32, TRemoveCVRef<int32&&>::Type>::Value));
always_check((TIsSame<int32, TRemoveCVRef<const int32>::Type>::Value));
always_check((TIsSame<int32, TRemoveCVRef<volatile int32>::Type>::Value));
always_check((TIsSame<int32, TRemoveCVRef<const volatile int32>::Type>::Value));
always_check((TIsSame<int32, TRemoveCVRef<const volatile int32&>::Type>::Value));
always_check((TIsSame<int32, TRemoveExtent<int32[1]>::Type>::Value)); always_check((CSameAs<int32, TMakeSigned<int32>::Type>));
always_check(!(TIsSame<int32, TRemoveExtent<int32[1][2]>::Type>::Value)); always_check((CSameAs<int32, TMakeSigned<uint32>::Type>));
always_check((TIsSame<int32[2][3], TRemoveExtent<int32[1][2][3]>::Type>::Value));
always_check((TIsSame<int32, TRemoveAllExtents<int32[1]>::Type>::Value)); always_check((CSameAs<uint32, TMakeUnsigned<int32>::Type>));
always_check((TIsSame<int32, TRemoveAllExtents<int32[1][2]>::Type>::Value)); always_check((CSameAs<uint32, TMakeUnsigned<uint32>::Type>));
always_check((TIsSame<int32, TRemoveAllExtents<int32[1][2][3]>::Type>::Value));
always_check((TIsSame<int32, TMakeSigned<int32>::Type>::Value));
always_check((TIsSame<int32, TMakeSigned<uint32>::Type>::Value));
always_check((TIsSame<uint32, TMakeUnsigned<int32>::Type>::Value));
always_check((TIsSame<uint32, TMakeUnsigned<uint32>::Type>::Value));
TAlignedStorage<32, 4>::Type Aligned4; TAlignedStorage<32, 4>::Type Aligned4;
TAlignedStorage<32, 8>::Type Aligned8; TAlignedStorage<32, 8>::Type Aligned8;
@ -415,40 +404,60 @@ void TestTypeTraits()
always_check(sizeof(TAlignedUnion<0, int32, int64>::Type) == 8); always_check(sizeof(TAlignedUnion<0, int32, int64>::Type) == 8);
always_check(sizeof(TAlignedUnion<0, int32, double>::Type) == 8); always_check(sizeof(TAlignedUnion<0, int32, double>::Type) == 8);
always_check((TIsSame<int32, TDecay<int32>::Type>::Value)); always_check((CSameAs<int32, TDecay<int32>::Type>));
always_check((TIsSame<int32*, TDecay<int32*>::Type>::Value)); always_check((CSameAs<int32*, TDecay<int32*>::Type>));
always_check((TIsSame<int32*, TDecay<int32[]>::Type>::Value)); always_check((CSameAs<int32*, TDecay<int32[]>::Type>));
always_check((TIsSame<int32, TDecay<int32&>::Type>::Value)); always_check((CSameAs<int32, TDecay<int32&>::Type>));
always_check((TIsSame<int32, TDecay<int32&&>::Type>::Value)); always_check((CSameAs<int32, TDecay<int32&&>::Type>));
always_check((TIsSame<int32, TDecay<const int32>::Type>::Value)); always_check((CSameAs<int32, TDecay<const int32>::Type>));
always_check((TIsSame<int32, TDecay<volatile int32>::Type>::Value)); always_check((CSameAs<int32, TDecay<volatile int32>::Type>));
always_check((TIsSame<int32, TDecay<const volatile int32>::Type>::Value)); always_check((CSameAs<int32, TDecay<const volatile int32>::Type>));
always_check((TIsSame<int32, TDecay<const volatile int32&>::Type>::Value)); always_check((CSameAs<int32, TDecay<const volatile int32&>::Type>));
always_check((TIsSame<int32, TConditional<true, int32, int64>::Type>::Value)); always_check((CSameAs<int32, TConditional<true, int32, int64>::Type>));
always_check((TIsSame<int64, TConditional<false, int32, int64>::Type>::Value)); always_check((CSameAs<int64, TConditional<false, int32, int64>::Type>));
always_check((TIsSame<int, TUnderlyingType<ETestEnumClass>::Type>::Value)); always_check((CSameAs<int, TUnderlyingType<ETestEnumClass>::Type>));
always_check((TIsSame<uint8, TUnderlyingType<ETestEnumClass8>::Type>::Value)); always_check((CSameAs<uint8, TUnderlyingType<ETestEnumClass8>::Type>));
always_check((TIsSame<uint32, TUnderlyingType<ETestEnumClass32>::Type>::Value)); always_check((CSameAs<uint32, TUnderlyingType<ETestEnumClass32>::Type>));
always_check((TIsSame<uint64, TUnderlyingType<ETestEnumClass64>::Type>::Value)); always_check((CSameAs<uint64, TUnderlyingType<ETestEnumClass64>::Type>));
always_check((TIsSame<int32, TInvokeResult<int32()>::Type>::Value)); always_check((CSameAs<void, TVoid<int32>::Type>));
always_check((TIsSame<int32, TInvokeResult<int32(int32), int32>::Type>::Value)); always_check((CSameAs<void, TVoid<int32, int64>::Type>));
// always_check((TIsSame<char(&)[2], TInvokeResult<char(&())[2]>::Type>::Value));
always_check((TIsSame<void, TVoid<int32>::Type>::Value)); // Invocable.h
always_check((TIsSame<void, TVoid<int32, int64>::Type>::Value));
always_check((CInvocable<int32()>));
always_check((CInvocable<int32(int32), int32>));
always_check(!(CInvocable<int32(int32), FTestStructA>));
always_check((CInvocable<int32(int32), int32>));
always_check((CInvocableResult<void, int32()>));
always_check((CInvocableResult<int32, int32()>));
always_check((CInvocableResult<int32, int32(int32), int32>));
always_check(!(CInvocableResult<int32, int32(int32), FTestStructA>));
always_check(!(CInvocableResult<FTestStructA, int32(int32), int32>));
always_check((CSameAs<int32, TInvokeResult<int32()>::Type>));
always_check((CSameAs<int32, TInvokeResult<int32(int32), int32>::Type>));
// always_check((CSameAs<char(&)[2], TInvokeResult<char(&())[2]>::Type>));
always_check((CInvocable <decltype([]( ) -> void { }) >));
always_check((CRegularInvocable <decltype([](int32 A ) -> int32 { return A; }), int32 >));
always_check((CPredicate <decltype([](int32 A, int32 B, int32 C) -> bool { return (A + B + C) == 0; }), int32, int32, int32 >));
always_check((CRelation <decltype([](int32 A, int32 B ) -> bool { return (A ^ B) == 0; }), int32, int32 >));
always_check((CEquivalenceRelation<decltype([](int32 A, int32 B ) -> bool { return A == B; }), int32, int32 >));
always_check((CStrictWeakOrder <decltype([](int32 A, int32 B ) -> bool { return A < B; }), int32, int32 >));
// Common.h // Common.h
always_check((TIsSame<int32, TCommonType<int8, int32>::Type>::Value)); always_check((CSameAs<int32, TCommonType<int8, int32>::Type>));
always_check((TIsSame<int64, TCommonType<int8, int32, int64>::Type>::Value)); always_check((CSameAs<int64, TCommonType<int8, int32, int64>::Type>));
always_check((TIsSame<double, TCommonType<float, double>::Type>::Value)); always_check((CSameAs<double, TCommonType<float, double>::Type>));
always_check((TIsSame<int32, TCommonReference<int8, int32>::Type>::Value)); always_check((CSameAs<int32, TCommonReference<int8, int32>::Type>));
always_check((TIsSame<int64, TCommonReference<int8, int32, int64>::Type>::Value)); always_check((CSameAs<int64, TCommonReference<int8, int32, int64>::Type>));
always_check((TIsSame<double, TCommonReference<float, double>::Type>::Value)); always_check((CSameAs<double, TCommonReference<float, double>::Type>));
// Swappable.h // Swappable.h
@ -461,81 +470,88 @@ void TestTypeTraits()
// CopyQualifiers.h // CopyQualifiers.h
always_check((TIsSame< int32, TCopyConst< int32, int32>::Type>::Value)); always_check((CSameAs< int32, TCopyConst< int32, int32>::Type>));
always_check((TIsSame<const int32, TCopyConst<const int32, int32>::Type>::Value)); always_check((CSameAs<const int32, TCopyConst<const int32, int32>::Type>));
always_check((TIsSame<const int32, TCopyConst<const volatile int32, int32>::Type>::Value)); always_check((CSameAs<const int32, TCopyConst<const volatile int32, int32>::Type>));
always_check((TIsSame<const int32, TCopyConst< int32, const int32>::Type>::Value)); always_check((CSameAs<const int32, TCopyConst< int32, const int32>::Type>));
always_check((TIsSame<const int32, TCopyConst<const int32, const int32>::Type>::Value)); always_check((CSameAs<const int32, TCopyConst<const int32, const int32>::Type>));
always_check((TIsSame<const int32, TCopyConst<const volatile int32, const int32>::Type>::Value)); always_check((CSameAs<const int32, TCopyConst<const volatile int32, const int32>::Type>));
always_check((TIsSame<const volatile int32, TCopyConst< int32, const volatile int32>::Type>::Value)); always_check((CSameAs<const volatile int32, TCopyConst< int32, const volatile int32>::Type>));
always_check((TIsSame<const volatile int32, TCopyConst<const int32, const volatile int32>::Type>::Value)); always_check((CSameAs<const volatile int32, TCopyConst<const int32, const volatile int32>::Type>));
always_check((TIsSame<const volatile int32, TCopyConst<const volatile int32, const volatile int32>::Type>::Value)); always_check((CSameAs<const volatile int32, TCopyConst<const volatile int32, const volatile int32>::Type>));
always_check((TIsSame< int32, TCopyVolatile< int32, int32>::Type>::Value)); always_check((CSameAs< int32, TCopyVolatile< int32, int32>::Type>));
always_check((TIsSame< int32, TCopyVolatile<const int32, int32>::Type>::Value)); always_check((CSameAs< int32, TCopyVolatile<const int32, int32>::Type>));
always_check((TIsSame< volatile int32, TCopyVolatile<const volatile int32, int32>::Type>::Value)); always_check((CSameAs< volatile int32, TCopyVolatile<const volatile int32, int32>::Type>));
always_check((TIsSame<const int32, TCopyVolatile< int32, const int32>::Type>::Value)); always_check((CSameAs<const int32, TCopyVolatile< int32, const int32>::Type>));
always_check((TIsSame<const int32, TCopyVolatile<const int32, const int32>::Type>::Value)); always_check((CSameAs<const int32, TCopyVolatile<const int32, const int32>::Type>));
always_check((TIsSame<const volatile int32, TCopyVolatile<const volatile int32, const int32>::Type>::Value)); always_check((CSameAs<const volatile int32, TCopyVolatile<const volatile int32, const int32>::Type>));
always_check((TIsSame<const volatile int32, TCopyVolatile< int32, const volatile int32>::Type>::Value)); always_check((CSameAs<const volatile int32, TCopyVolatile< int32, const volatile int32>::Type>));
always_check((TIsSame<const volatile int32, TCopyVolatile<const int32, const volatile int32>::Type>::Value)); always_check((CSameAs<const volatile int32, TCopyVolatile<const int32, const volatile int32>::Type>));
always_check((TIsSame<const volatile int32, TCopyVolatile<const volatile int32, const volatile int32>::Type>::Value)); always_check((CSameAs<const volatile int32, TCopyVolatile<const volatile int32, const volatile int32>::Type>));
always_check((TIsSame< int32, TCopyCV< int32, int32>::Type>::Value)); always_check((CSameAs< int32, TCopyCV< int32, int32>::Type>));
always_check((TIsSame<const int32, TCopyCV<const int32, int32>::Type>::Value)); always_check((CSameAs<const int32, TCopyCV<const int32, int32>::Type>));
always_check((TIsSame<const volatile int32, TCopyCV<const volatile int32, int32>::Type>::Value)); always_check((CSameAs<const volatile int32, TCopyCV<const volatile int32, int32>::Type>));
always_check((TIsSame<const int32, TCopyCV< int32, const int32>::Type>::Value)); always_check((CSameAs<const int32, TCopyCV< int32, const int32>::Type>));
always_check((TIsSame<const int32, TCopyCV<const int32, const int32>::Type>::Value)); always_check((CSameAs<const int32, TCopyCV<const int32, const int32>::Type>));
always_check((TIsSame<const volatile int32, TCopyCV<const volatile int32, const int32>::Type>::Value)); always_check((CSameAs<const volatile int32, TCopyCV<const volatile int32, const int32>::Type>));
always_check((TIsSame<const volatile int32, TCopyCV< int32, const volatile int32>::Type>::Value)); always_check((CSameAs<const volatile int32, TCopyCV< int32, const volatile int32>::Type>));
always_check((TIsSame<const volatile int32, TCopyCV<const int32, const volatile int32>::Type>::Value)); always_check((CSameAs<const volatile int32, TCopyCV<const int32, const volatile int32>::Type>));
always_check((TIsSame<const volatile int32, TCopyCV<const volatile int32, const volatile int32>::Type>::Value)); always_check((CSameAs<const volatile int32, TCopyCV<const volatile int32, const volatile int32>::Type>));
always_check((TIsSame<int32, TCopyReference<int32, int32 >::Type>::Value)); always_check((CSameAs<int32, TCopyReference<int32, int32 >::Type>));
always_check((TIsSame<int32&, TCopyReference<int32, int32& >::Type>::Value)); always_check((CSameAs<int32&, TCopyReference<int32, int32& >::Type>));
always_check((TIsSame<int32&&, TCopyReference<int32, int32&&>::Type>::Value)); always_check((CSameAs<int32&&, TCopyReference<int32, int32&&>::Type>));
always_check((TIsSame<int32&, TCopyReference<int32&, int32 >::Type>::Value)); always_check((CSameAs<int32&, TCopyReference<int32&, int32 >::Type>));
always_check((TIsSame<int32&, TCopyReference<int32&, int32& >::Type>::Value)); always_check((CSameAs<int32&, TCopyReference<int32&, int32& >::Type>));
always_check((TIsSame<int32&, TCopyReference<int32&, int32&&>::Type>::Value)); always_check((CSameAs<int32&, TCopyReference<int32&, int32&&>::Type>));
always_check((TIsSame<int32&&, TCopyReference<int32&&, int32 >::Type>::Value)); always_check((CSameAs<int32&&, TCopyReference<int32&&, int32 >::Type>));
always_check((TIsSame<int32&, TCopyReference<int32&&, int32& >::Type>::Value)); always_check((CSameAs<int32&, TCopyReference<int32&&, int32& >::Type>));
always_check((TIsSame<int32&&, TCopyReference<int32&&, int32&&>::Type>::Value)); always_check((CSameAs<int32&&, TCopyReference<int32&&, int32&&>::Type>));
always_check((TIsSame< int32, TCopyCVRef< int32, int32>::Type>::Value)); always_check((CSameAs< int32, TCopyCVRef< int32, int32>::Type>));
always_check((TIsSame<const int32, TCopyCVRef<const int32, int32>::Type>::Value)); always_check((CSameAs<const int32, TCopyCVRef<const int32, int32>::Type>));
always_check((TIsSame<const int32, TCopyCVRef< int32, const int32>::Type>::Value)); always_check((CSameAs<const int32, TCopyCVRef< int32, const int32>::Type>));
always_check((TIsSame<const int32, TCopyCVRef<const int32, const int32>::Type>::Value)); always_check((CSameAs<const int32, TCopyCVRef<const int32, const int32>::Type>));
always_check((TIsSame< volatile int32, TCopyCVRef< volatile int32, int32>::Type>::Value)); always_check((CSameAs< volatile int32, TCopyCVRef< volatile int32, int32>::Type>));
always_check((TIsSame< volatile int32, TCopyCVRef< int32, volatile int32>::Type>::Value)); always_check((CSameAs< volatile int32, TCopyCVRef< int32, volatile int32>::Type>));
always_check((TIsSame< volatile int32, TCopyCVRef< volatile int32, volatile int32>::Type>::Value)); always_check((CSameAs< volatile int32, TCopyCVRef< volatile int32, volatile int32>::Type>));
always_check((TIsSame<const int32, TCopyCVRef<const int32, int32>::Type>::Value)); always_check((CSameAs<const int32, TCopyCVRef<const int32, int32>::Type>));
always_check((TIsSame<const volatile int32, TCopyCVRef<const volatile int32, int32>::Type>::Value)); always_check((CSameAs<const volatile int32, TCopyCVRef<const volatile int32, int32>::Type>));
always_check((TIsSame<const int32, TCopyCVRef< int32, const int32>::Type>::Value)); always_check((CSameAs<const int32, TCopyCVRef< int32, const int32>::Type>));
always_check((TIsSame<const int32, TCopyCVRef<const int32, const int32>::Type>::Value)); always_check((CSameAs<const int32, TCopyCVRef<const int32, const int32>::Type>));
always_check((TIsSame<const volatile int32, TCopyCVRef<const volatile int32, const int32>::Type>::Value)); always_check((CSameAs<const volatile int32, TCopyCVRef<const volatile int32, const int32>::Type>));
always_check((TIsSame<const volatile int32, TCopyCVRef< int32, const volatile int32>::Type>::Value)); always_check((CSameAs<const volatile int32, TCopyCVRef< int32, const volatile int32>::Type>));
always_check((TIsSame<const volatile int32, TCopyCVRef<const int32, const volatile int32>::Type>::Value)); always_check((CSameAs<const volatile int32, TCopyCVRef<const int32, const volatile int32>::Type>));
always_check((TIsSame<const volatile int32, TCopyCVRef<const volatile int32, const volatile int32>::Type>::Value)); always_check((CSameAs<const volatile int32, TCopyCVRef<const volatile int32, const volatile int32>::Type>));
always_check((TIsSame<int32, TCopyCVRef<int32, int32 >::Type>::Value)); always_check((CSameAs<int32, TCopyCVRef<int32, int32 >::Type>));
always_check((TIsSame<int32&, TCopyCVRef<int32, int32& >::Type>::Value)); always_check((CSameAs<int32&, TCopyCVRef<int32, int32& >::Type>));
always_check((TIsSame<int32&&, TCopyCVRef<int32, int32&&>::Type>::Value)); always_check((CSameAs<int32&&, TCopyCVRef<int32, int32&&>::Type>));
always_check((TIsSame<int32&, TCopyCVRef<int32&, int32 >::Type>::Value)); always_check((CSameAs<int32&, TCopyCVRef<int32&, int32 >::Type>));
always_check((TIsSame<int32&, TCopyCVRef<int32&, int32& >::Type>::Value)); always_check((CSameAs<int32&, TCopyCVRef<int32&, int32& >::Type>));
always_check((TIsSame<int32&, TCopyCVRef<int32&, int32&&>::Type>::Value)); always_check((CSameAs<int32&, TCopyCVRef<int32&, int32&&>::Type>));
always_check((TIsSame<int32&&, TCopyCVRef<int32&&, int32 >::Type>::Value)); always_check((CSameAs<int32&&, TCopyCVRef<int32&&, int32 >::Type>));
always_check((TIsSame<int32&, TCopyCVRef<int32&&, int32& >::Type>::Value)); always_check((CSameAs<int32&, TCopyCVRef<int32&&, int32& >::Type>));
always_check((TIsSame<int32&&, TCopyCVRef<int32&&, int32&&>::Type>::Value)); always_check((CSameAs<int32&&, TCopyCVRef<int32&&, int32&&>::Type>));
always_check((TIsSame<const int32, TCopyCVRef<const int32, int32 >::Type>::Value)); always_check((CSameAs<const int32, TCopyCVRef<const int32, int32 >::Type>));
always_check((TIsSame<const int32&, TCopyCVRef< int32, const int32& >::Type>::Value)); always_check((CSameAs<const int32&, TCopyCVRef< int32, const int32& >::Type>));
always_check((TIsSame<const volatile int32&&, TCopyCVRef<const volatile int32, const int32&&>::Type>::Value)); always_check((CSameAs<const volatile int32&&, TCopyCVRef<const volatile int32, const int32&&>::Type>));
always_check((TIsSame<const int32&, TCopyCVRef<const int32&, int32 >::Type>::Value)); always_check((CSameAs<const int32&, TCopyCVRef<const int32&, int32 >::Type>));
always_check((TIsSame<const int32&, TCopyCVRef<const int32&, const int32& >::Type>::Value)); always_check((CSameAs<const int32&, TCopyCVRef<const int32&, const int32& >::Type>));
always_check((TIsSame<const volatile int32&, TCopyCVRef< volatile int32&, const int32&&>::Type>::Value)); always_check((CSameAs<const volatile int32&, TCopyCVRef< volatile int32&, const int32&&>::Type>));
always_check((TIsSame<const int32&&, TCopyCVRef<const int32&&, int32 >::Type>::Value)); always_check((CSameAs<const int32&&, TCopyCVRef<const int32&&, int32 >::Type>));
always_check((TIsSame<const int32&, TCopyCVRef<const int32&&, const int32& >::Type>::Value)); always_check((CSameAs<const int32&, TCopyCVRef<const int32&&, const int32& >::Type>));
always_check((TIsSame<const volatile int32&&, TCopyCVRef<const volatile int32&&, const int32&&>::Type>::Value)); always_check((CSameAs<const volatile int32&&, TCopyCVRef<const volatile int32&&, const int32&&>::Type>));
// BooleanTestable.h
always_check(CBooleanTestable<bool>);
always_check(CBooleanTestable<int32>);
always_check(CBooleanTestable<float>);
always_check(!CBooleanTestable<FTestStructA>);
} }

View File

@ -1,18 +1,12 @@
#pragma once #pragma once
#include "CoreTypes.h" #include "CoreTypes.h"
#include "Templates/Utility.h"
#include "Concepts/Convertible.h"
#include "TypeTraits/TypeTraits.h" #include "TypeTraits/TypeTraits.h"
NAMESPACE_REDCRAFT_BEGIN NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility) NAMESPACE_MODULE_BEGIN(Utility)
template <typename T>
concept CBooleanTestable = CConvertibleTo<T, bool> &&
requires(T && B) { { !Forward<T>(B) } -> CConvertibleTo<bool>; };
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft) NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END NAMESPACE_REDCRAFT_END

View File

@ -7,9 +7,6 @@ NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility) NAMESPACE_MODULE_BEGIN(Utility)
template <typename T, typename U>
concept CConvertibleTo = TIsConvertible<T, U>::Value && requires(T(&Func)()) { static_cast<U>(Func()); };
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft) NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END NAMESPACE_REDCRAFT_END

View File

@ -2,14 +2,13 @@
#include "CoreTypes.h" #include "CoreTypes.h"
#include "TypeTraits/TypeTraits.h" #include "TypeTraits/TypeTraits.h"
#include "Concepts/Convertible.h"
NAMESPACE_REDCRAFT_BEGIN NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility) NAMESPACE_MODULE_BEGIN(Utility)
template <typename T, typename U> template <typename T, typename U>
concept CDerivedFrom = TIsBaseOf<U, T>::Value && CConvertibleTo<const volatile T*, const volatile U*>; concept CDerivedFrom = CBaseOf<U, T> && CConvertibleTo<const volatile T*, const volatile U*>;
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft) NAMESPACE_MODULE_END(Redcraft)

View File

@ -7,26 +7,6 @@ NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility) NAMESPACE_MODULE_BEGIN(Utility)
template <typename F, typename... Types>
concept CInvocable = requires(F&& Func, Types&&... Args) { Invoke(Forward<F>(Func), Forward<Types>(Args)...); };
template <typename F, typename... Types>
concept CRegularInvocable = CInvocable<F, Types...>;
template <typename F, typename... Types>
concept CPredicate = CRegularInvocable<F, Types...> && CBooleanTestable<typename TInvokeResult<F, Types...>::Type>;
template <typename R, typename T, typename U>
concept CRelation =
CPredicate<R, T, T> && CPredicate<R, U, U> &&
CPredicate<R, T, U> && CPredicate<R, U, T>;
template <typename R, typename T, typename U>
concept CEquivalenceRelation = CRelation<R, T, U>;
template <typename R, typename T, typename U>
concept CStrictWeakOrder = CRelation<R, T, U>;
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft) NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END NAMESPACE_REDCRAFT_END

View File

@ -7,9 +7,6 @@ NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility) NAMESPACE_MODULE_BEGIN(Utility)
template <typename T, typename U>
concept CSameAs = TIsSame<T, U>::Value && TIsSame<U, T>::Value;
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft) NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END NAMESPACE_REDCRAFT_END

View File

@ -31,9 +31,9 @@ template <typename... Types>
struct TCommonComparisonCategory struct TCommonComparisonCategory
: NAMESPACE_PRIVATE::TCommonComparisonCategory<(0u | ... | : NAMESPACE_PRIVATE::TCommonComparisonCategory<(0u | ... |
( (
TIsSame<Types, strong_ordering >::Value ? 0u : CSameAs<Types, strong_ordering > ? 0u :
TIsSame<Types, weak_ordering >::Value ? 4u : CSameAs<Types, weak_ordering > ? 4u :
TIsSame<Types, partial_ordering>::Value ? 2u : 1u CSameAs<Types, partial_ordering> ? 2u : 1u
) )
)> )>
{ }; { };

View File

@ -76,7 +76,7 @@ struct alignas(InlineAlignment) TAny
EmplaceImpl<SelectedType>(Forward<Types>(Args)...); EmplaceImpl<SelectedType>(Forward<Types>(Args)...);
} }
template <typename T> requires (!TIsSame<typename TDecay<T>::Type, TAny>::Value) && (!TIsTInPlaceType<typename TDecay<T>::Type>::Value) template <typename T> requires (!CSameAs<typename TDecay<T>::Type, TAny>) && (!TIsTInPlaceType<typename TDecay<T>::Type>::Value)
&& CDestructible<typename TDecay<T>::Type> && CConstructible<typename TDecay<T>::Type, T&&> && CDestructible<typename TDecay<T>::Type> && CConstructible<typename TDecay<T>::Type, T&&>
FORCEINLINE TAny(T&& InValue) : TAny(InPlaceType<typename TDecay<T>::Type>, Forward<T>(InValue)) FORCEINLINE TAny(T&& InValue) : TAny(InPlaceType<typename TDecay<T>::Type>, Forward<T>(InValue))
{ } { }
@ -184,7 +184,7 @@ struct alignas(InlineAlignment) TAny
return *this; return *this;
} }
template <typename T> requires (!TIsSame<typename TDecay<T>::Type, TAny>::Value) && (!TIsTInPlaceType<typename TDecay<T>::Type>::Value) template <typename T> requires (!CSameAs<typename TDecay<T>::Type, TAny>) && (!TIsTInPlaceType<typename TDecay<T>::Type>::Value)
&& CDestructible<typename TDecay<T>::Type> && CConstructible<typename TDecay<T>::Type, T&&> && CDestructible<typename TDecay<T>::Type> && CConstructible<typename TDecay<T>::Type, T&&>
FORCEINLINE TAny& operator=(T&& InValue) FORCEINLINE TAny& operator=(T&& InValue)
{ {
@ -233,10 +233,10 @@ struct alignas(InlineAlignment) TAny
template <typename T> requires CDestructible<typename TDecay<T>::Type> template <typename T> requires CDestructible<typename TDecay<T>::Type>
constexpr const T&& GetValue() const&& { checkf(HoldsAlternative<T>(), TEXT("It is an error to call GetValue() on an wrong TAny. Please either check HoldsAlternative() or use Get(DefaultValue) instead.")); return MoveTemp(*reinterpret_cast<const T*>(GetAllocation())); } constexpr const T&& GetValue() const&& { checkf(HoldsAlternative<T>(), TEXT("It is an error to call GetValue() on an wrong TAny. Please either check HoldsAlternative() or use Get(DefaultValue) instead.")); return MoveTemp(*reinterpret_cast<const T*>(GetAllocation())); }
template <typename T> requires TIsSame<T, typename TDecay<T>::Type>::Value&& CDestructible<typename TDecay<T>::Type> template <typename T> requires CSameAs<T, typename TDecay<T>::Type>&& CDestructible<typename TDecay<T>::Type>
constexpr T& Get( T& DefaultValue) & { return HoldsAlternative<T>() ? GetValue<T>() : DefaultValue; } constexpr T& Get( T& DefaultValue) & { return HoldsAlternative<T>() ? GetValue<T>() : DefaultValue; }
template <typename T> requires TIsSame<T, typename TDecay<T>::Type>::Value&& CDestructible<typename TDecay<T>::Type> template <typename T> requires CSameAs<T, typename TDecay<T>::Type>&& CDestructible<typename TDecay<T>::Type>
constexpr const T& Get(const T& DefaultValue) const& { return HoldsAlternative<T>() ? GetValue<T>() : DefaultValue; } constexpr const T& Get(const T& DefaultValue) const& { return HoldsAlternative<T>() ? GetValue<T>() : DefaultValue; }
FORCEINLINE void Reset() FORCEINLINE void Reset()

View File

@ -121,7 +121,7 @@ public:
FORCEINLINE void Notify(bool bIsAll = false) { if (bIsAll) Element.notify_all(); else Element.notify_one(); } FORCEINLINE void Notify(bool bIsAll = false) { if (bIsAll) Element.notify_all(); else Element.notify_one(); }
FORCEINLINE void Notify(bool bIsAll = false) volatile { if (bIsAll) Element.notify_all(); else Element.notify_one(); } FORCEINLINE void Notify(bool bIsAll = false) volatile { if (bIsAll) Element.notify_all(); else Element.notify_one(); }
template <typename F> requires TIsInvocableResult<ValueType, F, ValueType>::Value template <typename F> requires CInvocableResult<ValueType, F, ValueType>
FORCEINLINE ValueType FetchFn(F&& Func, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) FORCEINLINE ValueType FetchFn(F&& Func, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent)
{ {
ValueType Temp(Load(EMemoryOrder::Relaxed)); ValueType Temp(Load(EMemoryOrder::Relaxed));
@ -129,7 +129,7 @@ public:
return Temp; return Temp;
} }
template <typename F> requires TIsInvocableResult<ValueType, F, ValueType>::Value && bIsAlwaysLockFree template <typename F> requires CInvocableResult<ValueType, F, ValueType> && bIsAlwaysLockFree
FORCEINLINE ValueType FetchFn(F&& Func, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile FORCEINLINE ValueType FetchFn(F&& Func, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile
{ {
ValueType Temp(Load(EMemoryOrder::Relaxed)); ValueType Temp(Load(EMemoryOrder::Relaxed));

View File

@ -56,19 +56,19 @@ template <typename Signature, typename F> struct TIsInvocableSignature : FFalse
template <typename Ret, typename... Types, typename F> template <typename Ret, typename... Types, typename F>
struct TIsInvocableSignature<Ret(Types...), F> struct TIsInvocableSignature<Ret(Types...), F>
: TBoolConstant<TIsInvocableResult<Ret, F, Types...>::Value && TIsInvocableResult<Ret, F&, Types...>::Value> : TBoolConstant<CInvocableResult<Ret, F, Types...> && CInvocableResult<Ret, F&, Types...>>
{ }; { };
template <typename Ret, typename... Types, typename F> struct TIsInvocableSignature<Ret(Types...) & , F> : TIsInvocableResult<Ret, F&, Types...> { }; template <typename Ret, typename... Types, typename F> struct TIsInvocableSignature<Ret(Types...) & , F> : TBoolConstant<CInvocableResult<Ret, F&, Types...>> { };
template <typename Ret, typename... Types, typename F> struct TIsInvocableSignature<Ret(Types...) &&, F> : TIsInvocableResult<Ret, F , Types...> { }; template <typename Ret, typename... Types, typename F> struct TIsInvocableSignature<Ret(Types...) &&, F> : TBoolConstant<CInvocableResult<Ret, F , Types...>> { };
template <typename Ret, typename... Types, typename F> template <typename Ret, typename... Types, typename F>
struct TIsInvocableSignature<Ret(Types...) const, F> struct TIsInvocableSignature<Ret(Types...) const, F>
: TBoolConstant<TIsInvocableResult<Ret, const F, Types...>::Value && TIsInvocableResult<Ret, const F&, Types...>::Value> : TBoolConstant<CInvocableResult<Ret, const F, Types...> && CInvocableResult<Ret, const F&, Types...>>
{ }; { };
template <typename Ret, typename... Types, typename F> struct TIsInvocableSignature<Ret(Types...) const& , F> : TIsInvocableResult<Ret, const F&, Types...> { }; template <typename Ret, typename... Types, typename F> struct TIsInvocableSignature<Ret(Types...) const& , F> : TBoolConstant<CInvocableResult<Ret, const F&, Types...>> { };
template <typename Ret, typename... Types, typename F> struct TIsInvocableSignature<Ret(Types...) const&&, F> : TIsInvocableResult<Ret, const F , Types...> { }; template <typename Ret, typename... Types, typename F> struct TIsInvocableSignature<Ret(Types...) const&&, F> : TBoolConstant<CInvocableResult<Ret, const F , Types...>> { };
template <typename F> struct TFunctionInfo; template <typename F> struct TFunctionInfo;
template <typename Ret, typename... Types> struct TFunctionInfo<Ret(Types...) > { using Fn = Ret(Types...); using CVRef = int; }; template <typename Ret, typename... Types> struct TFunctionInfo<Ret(Types...) > { using Fn = Ret(Types...); using CVRef = int; };
@ -95,12 +95,12 @@ public:
TFunctionImpl& operator=(TFunctionImpl&&) = default; TFunctionImpl& operator=(TFunctionImpl&&) = default;
~TFunctionImpl() = default; ~TFunctionImpl() = default;
FORCEINLINE ResultType operator()(Types... Args) requires (TIsSame<CVRef, int >::Value) { return CallImpl(Forward<Types>(Args)...); } FORCEINLINE ResultType operator()(Types... Args) requires (CSameAs<CVRef, int >) { return CallImpl(Forward<Types>(Args)...); }
FORCEINLINE ResultType operator()(Types... Args) & requires (TIsSame<CVRef, int& >::Value) { return CallImpl(Forward<Types>(Args)...); } FORCEINLINE ResultType operator()(Types... Args) & requires (CSameAs<CVRef, int& >) { return CallImpl(Forward<Types>(Args)...); }
FORCEINLINE ResultType operator()(Types... Args) && requires (TIsSame<CVRef, int&&>::Value) { return CallImpl(Forward<Types>(Args)...); } FORCEINLINE ResultType operator()(Types... Args) && requires (CSameAs<CVRef, int&&>) { return CallImpl(Forward<Types>(Args)...); }
FORCEINLINE ResultType operator()(Types... Args) const requires (TIsSame<CVRef, const int >::Value) { return CallImpl(Forward<Types>(Args)...); } FORCEINLINE ResultType operator()(Types... Args) const requires (CSameAs<CVRef, const int >) { return CallImpl(Forward<Types>(Args)...); }
FORCEINLINE ResultType operator()(Types... Args) const& requires (TIsSame<CVRef, const int& >::Value) { return CallImpl(Forward<Types>(Args)...); } FORCEINLINE ResultType operator()(Types... Args) const& requires (CSameAs<CVRef, const int& >) { return CallImpl(Forward<Types>(Args)...); }
FORCEINLINE ResultType operator()(Types... Args) const&& requires (TIsSame<CVRef, const int&&>::Value) { return CallImpl(Forward<Types>(Args)...); } FORCEINLINE ResultType operator()(Types... Args) const&& requires (CSameAs<CVRef, const int&&>) { return CallImpl(Forward<Types>(Args)...); }
constexpr bool IsValid() const { return Callable != nullptr; } constexpr bool IsValid() const { return Callable != nullptr; }
constexpr explicit operator bool() const { return Callable != nullptr; } constexpr explicit operator bool() const { return Callable != nullptr; }
@ -478,28 +478,28 @@ struct TNotFunction
template <typename InF> template <typename InF>
constexpr TNotFunction(InF&& InFunc) : Storage(Forward<InF>(InFunc)) { } constexpr TNotFunction(InF&& InFunc) : Storage(Forward<InF>(InFunc)) { }
template <typename... Types> requires TIsInvocable<F&, Types&&...>::Value template <typename... Types> requires CInvocable<F&, Types&&...>
constexpr auto operator()(Types&&... Args) & constexpr auto operator()(Types&&... Args) &
-> decltype(!Invoke(Storage, Forward<Types>(Args)...)) -> decltype(!Invoke(Storage, Forward<Types>(Args)...))
{ {
return !Invoke(Storage, Forward<Types>(Args)...); return !Invoke(Storage, Forward<Types>(Args)...);
} }
template <typename... Types> requires TIsInvocable<F&&, Types&&...>::Value template <typename... Types> requires CInvocable<F&&, Types&&...>
constexpr auto operator()(Types&&... Args) && constexpr auto operator()(Types&&... Args) &&
-> decltype(!Invoke(MoveTemp(Storage), Forward<Types>(Args)...)) -> decltype(!Invoke(MoveTemp(Storage), Forward<Types>(Args)...))
{ {
return !Invoke(MoveTemp(Storage), Forward<Types>(Args)...); return !Invoke(MoveTemp(Storage), Forward<Types>(Args)...);
} }
template <typename... Types> requires TIsInvocable<const F&, Types&&...>::Value template <typename... Types> requires CInvocable<const F&, Types&&...>
constexpr auto operator()(Types&&... Args) const& constexpr auto operator()(Types&&... Args) const&
-> decltype(!Invoke(Storage, Forward<Types>(Args)...)) -> decltype(!Invoke(Storage, Forward<Types>(Args)...))
{ {
return !Invoke(Storage, Forward<Types>(Args)...); return !Invoke(Storage, Forward<Types>(Args)...);
} }
template <typename... Types> requires TIsInvocable<const F&&, Types&&...>::Value template <typename... Types> requires CInvocable<const F&&, Types&&...>
constexpr auto operator()(Types&&... Args) const&& constexpr auto operator()(Types&&... Args) const&&
-> decltype(!Invoke(MoveTemp(Storage), Forward<Types>(Args)...)) -> decltype(!Invoke(MoveTemp(Storage), Forward<Types>(Args)...))
{ {

View File

@ -81,14 +81,14 @@ struct InvokeImpl<F, T, Types...> : InvokeMember<F, T> { };
NAMESPACE_PRIVATE_END NAMESPACE_PRIVATE_END
template <typename F, typename... Types> requires TIsInvocable<F, Types...>::Value template <typename F, typename... Types> requires CInvocable<F, Types...>
constexpr auto Invoke(F&& Func, Types&&... Args) constexpr auto Invoke(F&& Func, Types&&... Args)
-> decltype(NAMESPACE_PRIVATE::InvokeImpl<F, Types...>::Invoke(Forward<F>(Func), Forward<Types>(Args)...)) -> decltype(NAMESPACE_PRIVATE::InvokeImpl<F, Types...>::Invoke(Forward<F>(Func), Forward<Types>(Args)...))
{ {
return NAMESPACE_PRIVATE::InvokeImpl<F, Types...>::Invoke(Forward<F>(Func), Forward<Types>(Args)...); return NAMESPACE_PRIVATE::InvokeImpl<F, Types...>::Invoke(Forward<F>(Func), Forward<Types>(Args)...);
} }
template <typename R, typename F, typename... Types> requires TIsInvocableResult<R, F, Types...>::Value template <typename R, typename F, typename... Types> requires CInvocableResult<R, F, Types...>
constexpr R InvokeResult(F&& Func, Types&&... Args) constexpr R InvokeResult(F&& Func, Types&&... Args)
{ {
if constexpr (CVoid<R>) Invoke(Forward<F>(Func), Forward<Types>(Args)...); if constexpr (CVoid<R>) Invoke(Forward<F>(Func), Forward<Types>(Args)...);

View File

@ -23,10 +23,10 @@ private:
|| CConstructible<OptionalType, const TOptional<T>& > || CConstructible<OptionalType, const TOptional<T>& >
|| CConstructible<OptionalType, TOptional<T>&&> || CConstructible<OptionalType, TOptional<T>&&>
|| CConstructible<OptionalType, const TOptional<T>&&> || CConstructible<OptionalType, const TOptional<T>&&>
|| TIsConvertible< TOptional<T>&, OptionalType>::Value || CConvertibleTo< TOptional<T>&, OptionalType>
|| TIsConvertible<const TOptional<T>&, OptionalType>::Value || CConvertibleTo<const TOptional<T>&, OptionalType>
|| TIsConvertible< TOptional<T>&&, OptionalType>::Value || CConvertibleTo< TOptional<T>&&, OptionalType>
|| TIsConvertible<const TOptional<T>&&, OptionalType>::Value || CConvertibleTo<const TOptional<T>&&, OptionalType>
|| CAssignable<OptionalType&, TOptional<T>& > || CAssignable<OptionalType&, TOptional<T>& >
|| CAssignable<OptionalType&, const TOptional<T>& > || CAssignable<OptionalType&, const TOptional<T>& >
|| CAssignable<OptionalType&, TOptional<T>&&> || CAssignable<OptionalType&, TOptional<T>&&>
@ -49,8 +49,8 @@ public:
} }
template <typename T = OptionalType> requires CConstructible<OptionalType, T&&> template <typename T = OptionalType> requires CConstructible<OptionalType, T&&>
&& (!TIsSame<typename TRemoveCVRef<T>::Type, FInPlace>::Value) && (!TIsSame<typename TRemoveCVRef<T>::Type, TOptional>::Value) && (!CSameAs<typename TRemoveCVRef<T>::Type, FInPlace>) && (!CSameAs<typename TRemoveCVRef<T>::Type, TOptional>)
constexpr explicit (!TIsConvertible<T&&, OptionalType>::Value) TOptional(T&& InValue) constexpr explicit (!CConvertibleTo<T&&, OptionalType>) TOptional(T&& InValue)
: TOptional(InPlace, Forward<T>(InValue)) : TOptional(InPlace, Forward<T>(InValue))
{ } { }
@ -67,14 +67,14 @@ public:
} }
template <typename T = OptionalType> requires CConstructible<OptionalType, const T&> && TAllowUnwrapping<T>::Value template <typename T = OptionalType> requires CConstructible<OptionalType, const T&> && TAllowUnwrapping<T>::Value
constexpr explicit (!TIsConvertible<const T&, OptionalType>::Value) TOptional(const TOptional<T>& InValue) constexpr explicit (!CConvertibleTo<const T&, OptionalType>) TOptional(const TOptional<T>& InValue)
: bIsValid(InValue.IsValid()) : bIsValid(InValue.IsValid())
{ {
if (InValue.IsValid()) new(&Value) OptionalType(InValue.GetValue()); if (InValue.IsValid()) new(&Value) OptionalType(InValue.GetValue());
} }
template <typename T = OptionalType> requires CConstructible<OptionalType, T&&> && TAllowUnwrapping<T>::Value template <typename T = OptionalType> requires CConstructible<OptionalType, T&&> && TAllowUnwrapping<T>::Value
constexpr explicit (!TIsConvertible<T&&, OptionalType>::Value) TOptional(TOptional<T>&& InValue) constexpr explicit (!CConvertibleTo<T&&, OptionalType>) TOptional(TOptional<T>&& InValue)
: bIsValid(InValue.IsValid()) : bIsValid(InValue.IsValid())
{ {
if (InValue.IsValid()) new(&Value) OptionalType(MoveTemp(InValue.GetValue())); if (InValue.IsValid()) new(&Value) OptionalType(MoveTemp(InValue.GetValue()));

View File

@ -17,19 +17,19 @@ public:
using Type = ReferencedType; using Type = ReferencedType;
template <typename T = ReferencedType> requires TIsConvertible<T, ReferencedType&>::Value template <typename T = ReferencedType> requires CConvertibleTo<T, ReferencedType&>
constexpr TReferenceWrapper(T&& Object) : Pointer(AddressOf(Forward<T>(Object))) { } constexpr TReferenceWrapper(T&& Object) : Pointer(AddressOf(Forward<T>(Object))) { }
TReferenceWrapper(const TReferenceWrapper&) = default; TReferenceWrapper(const TReferenceWrapper&) = default;
template <typename T = ReferencedType> requires TIsConvertible<T&, ReferencedType&>::Value template <typename T = ReferencedType> requires CConvertibleTo<T&, ReferencedType&>
constexpr TReferenceWrapper(const TReferenceWrapper<T>& InValue) constexpr TReferenceWrapper(const TReferenceWrapper<T>& InValue)
: Pointer(InValue.Pointer) : Pointer(InValue.Pointer)
{ } { }
TReferenceWrapper& operator=(const TReferenceWrapper&) = default; TReferenceWrapper& operator=(const TReferenceWrapper&) = default;
template <typename T = ReferencedType> requires TIsConvertible<T&, ReferencedType&>::Value template <typename T = ReferencedType> requires CConvertibleTo<T&, ReferencedType&>
constexpr TReferenceWrapper& operator=(const TReferenceWrapper<T>& InValue) constexpr TReferenceWrapper& operator=(const TReferenceWrapper<T>& InValue)
{ {
Pointer = InValue.Pointer; Pointer = InValue.Pointer;
@ -120,10 +120,10 @@ private:
|| CConstructible<OptionalType, const TOptional<T>& > || CConstructible<OptionalType, const TOptional<T>& >
|| CConstructible<OptionalType, TOptional<T>&&> || CConstructible<OptionalType, TOptional<T>&&>
|| CConstructible<OptionalType, const TOptional<T>&&> || CConstructible<OptionalType, const TOptional<T>&&>
|| TIsConvertible< TOptional<T>&, OptionalType>::Value || CConvertibleTo< TOptional<T>&, OptionalType>
|| TIsConvertible<const TOptional<T>&, OptionalType>::Value || CConvertibleTo<const TOptional<T>&, OptionalType>
|| TIsConvertible< TOptional<T>&&, OptionalType>::Value || CConvertibleTo< TOptional<T>&&, OptionalType>
|| TIsConvertible<const TOptional<T>&&, OptionalType>::Value || CConvertibleTo<const TOptional<T>&&, OptionalType>
|| CAssignable<OptionalType&, TOptional<T>& > || CAssignable<OptionalType&, TOptional<T>& >
|| CAssignable<OptionalType&, const TOptional<T>& > || CAssignable<OptionalType&, const TOptional<T>& >
|| CAssignable<OptionalType&, TOptional<T>&&> || CAssignable<OptionalType&, TOptional<T>&&>
@ -144,8 +144,8 @@ public:
{ } { }
template <typename T = OptionalType> requires CConstructible<OptionalType, T&&> template <typename T = OptionalType> requires CConstructible<OptionalType, T&&>
&& (!TIsSame<typename TRemoveCVRef<T>::Type, FInPlace>::Value) && (!TIsSame<typename TRemoveCVRef<T>::Type, TOptional>::Value) && (!CSameAs<typename TRemoveCVRef<T>::Type, FInPlace>) && (!CSameAs<typename TRemoveCVRef<T>::Type, TOptional>)
constexpr explicit (!TIsConvertible<T&&, OptionalType>::Value) TOptional(T&& InValue) constexpr explicit (!CConvertibleTo<T&&, OptionalType>) TOptional(T&& InValue)
: TOptional(InPlace, Forward<T>(InValue)) : TOptional(InPlace, Forward<T>(InValue))
{ } { }
@ -153,7 +153,7 @@ public:
TOptional(TOptional&& InValue) = default; TOptional(TOptional&& InValue) = default;
template <typename T = OptionalType> requires CConstructible<OptionalType, const T&> && TAllowUnwrapping<T>::Value template <typename T = OptionalType> requires CConstructible<OptionalType, const T&> && TAllowUnwrapping<T>::Value
constexpr explicit (!TIsConvertible<const T&, OptionalType>::Value) TOptional(const TOptional<T>& InValue) constexpr explicit (!CConvertibleTo<const T&, OptionalType>) TOptional(const TOptional<T>& InValue)
: Reference(InValue.Reference) : Reference(InValue.Reference)
{ } { }

View File

@ -32,7 +32,7 @@ struct TTupleElementIndex;
template <typename T, typename U, typename... Types> template <typename T, typename U, typename... Types>
struct TTupleElementIndex<T, U, Types...> struct TTupleElementIndex<T, U, Types...>
: TConstant<size_t, TIsSame<T, U>::Value ? 0 : (TTupleElementIndex<T, Types...>::Value == INDEX_NONE : TConstant<size_t, CSameAs<T, U> ? 0 : (TTupleElementIndex<T, Types...>::Value == INDEX_NONE
? INDEX_NONE : TTupleElementIndex<T, Types...>::Value + 1)> ? INDEX_NONE : TTupleElementIndex<T, Types...>::Value + 1)>
{ }; { };
@ -237,54 +237,54 @@ public:
template <typename... ArgTypes> requires (ElementSize > 0) && (sizeof...(ArgTypes) == ElementSize) template <typename... ArgTypes> requires (ElementSize > 0) && (sizeof...(ArgTypes) == ElementSize)
&& (true && ... && CConstructible<Types, ArgTypes&&>) && (true && ... && CConstructible<Types, ArgTypes&&>)
&& (true && ... && TIsConvertible<ArgTypes&&, Types>::Value) && (true && ... && CConvertibleTo<ArgTypes&&, Types>)
constexpr TTuple(ArgTypes&&... Args) constexpr TTuple(ArgTypes&&... Args)
: Super(NAMESPACE_PRIVATE::ForwardingConstructor, Forward<ArgTypes>(Args)...) : Super(NAMESPACE_PRIVATE::ForwardingConstructor, Forward<ArgTypes>(Args)...)
{ } { }
template <typename... ArgTypes> requires (ElementSize > 0) && (sizeof...(ArgTypes) == ElementSize) template <typename... ArgTypes> requires (ElementSize > 0) && (sizeof...(ArgTypes) == ElementSize)
&& (true && ... && CConstructible<Types, ArgTypes&&>) && (true && ... && CConstructible<Types, ArgTypes&&>)
&& (!(true && ... && TIsConvertible<ArgTypes&&, Types>::Value)) && (!(true && ... && CConvertibleTo<ArgTypes&&, Types>))
constexpr explicit TTuple(ArgTypes&&... Args) constexpr explicit TTuple(ArgTypes&&... Args)
: Super(NAMESPACE_PRIVATE::ForwardingConstructor, Forward<ArgTypes>(Args)...) : Super(NAMESPACE_PRIVATE::ForwardingConstructor, Forward<ArgTypes>(Args)...)
{ } { }
template <typename... OtherTypes> requires (sizeof...(OtherTypes) == ElementSize) template <typename... OtherTypes> requires (sizeof...(OtherTypes) == ElementSize)
&& (true && ... && CConstructible<Types, const OtherTypes&>) && (true && ... && CConstructible<Types, const OtherTypes&>)
&& ((ElementSize != 1) || !(TIsConvertible<const TTuple<OtherTypes...>&, typename TElementType<0>::Type>::Value && ((ElementSize != 1) || !(CConvertibleTo<const TTuple<OtherTypes...>&, typename TElementType<0>::Type>
|| CConstructible<typename TElementType<0>::Type, const TTuple<OtherTypes...>&> || CConstructible<typename TElementType<0>::Type, const TTuple<OtherTypes...>&>
|| TIsSame<typename TElementType<0>::Type, typename TTuple<OtherTypes...>::template TElementType<0>::Type>::Value)) || CSameAs<typename TElementType<0>::Type, typename TTuple<OtherTypes...>::template TElementType<0>::Type>))
&& (true && ... && TIsConvertible<OtherTypes&&, Types>::Value) && (true && ... && CConvertibleTo<OtherTypes&&, Types>)
constexpr TTuple(const TTuple<OtherTypes...>& InValue) constexpr TTuple(const TTuple<OtherTypes...>& InValue)
: Super(NAMESPACE_PRIVATE::OtherTupleConstructor, InValue) : Super(NAMESPACE_PRIVATE::OtherTupleConstructor, InValue)
{ } { }
template <typename... OtherTypes> requires (sizeof...(OtherTypes) == ElementSize) template <typename... OtherTypes> requires (sizeof...(OtherTypes) == ElementSize)
&& (true && ... && CConstructible<Types, const OtherTypes&>) && (true && ... && CConstructible<Types, const OtherTypes&>)
&& ((ElementSize != 1) || !(TIsConvertible<const TTuple<OtherTypes...>&, typename TElementType<0>::Type>::Value && ((ElementSize != 1) || !(CConvertibleTo<const TTuple<OtherTypes...>&, typename TElementType<0>::Type>
|| CConstructible<typename TElementType<0>::Type, const TTuple<OtherTypes...>&> || CConstructible<typename TElementType<0>::Type, const TTuple<OtherTypes...>&>
|| TIsSame<typename TElementType<0>::Type, typename TTuple<OtherTypes...>::template TElementType<0>::Type>::Value)) || CSameAs<typename TElementType<0>::Type, typename TTuple<OtherTypes...>::template TElementType<0>::Type>))
&& (!(true && ... && TIsConvertible<OtherTypes&&, Types>::Value)) && (!(true && ... && CConvertibleTo<OtherTypes&&, Types>))
constexpr explicit TTuple(const TTuple<OtherTypes...>& InValue) constexpr explicit TTuple(const TTuple<OtherTypes...>& InValue)
: Super(NAMESPACE_PRIVATE::OtherTupleConstructor, InValue) : Super(NAMESPACE_PRIVATE::OtherTupleConstructor, InValue)
{ } { }
template <typename... OtherTypes> requires (sizeof...(OtherTypes) == ElementSize) template <typename... OtherTypes> requires (sizeof...(OtherTypes) == ElementSize)
&& (true && ... && CConstructible<Types, OtherTypes&&>) && (true && ... && CConstructible<Types, OtherTypes&&>)
&& ((ElementSize != 1) || !(TIsConvertible<TTuple<OtherTypes...>&&, typename TElementType<0>::Type>::Value && ((ElementSize != 1) || !(CConvertibleTo<TTuple<OtherTypes...>&&, typename TElementType<0>::Type>
|| CConstructible<typename TElementType<0>::Type, TTuple<OtherTypes...>&&> || CConstructible<typename TElementType<0>::Type, TTuple<OtherTypes...>&&>
|| TIsSame<typename TElementType<0>::Type, typename TTuple<OtherTypes...>::template TElementType<0>::Type>::Value)) || CSameAs<typename TElementType<0>::Type, typename TTuple<OtherTypes...>::template TElementType<0>::Type>))
&& (true && ... && TIsConvertible<OtherTypes&&, Types>::Value) && (true && ... && CConvertibleTo<OtherTypes&&, Types>)
constexpr TTuple(TTuple<OtherTypes...>&& InValue) constexpr TTuple(TTuple<OtherTypes...>&& InValue)
: Super(NAMESPACE_PRIVATE::OtherTupleConstructor, MoveTemp(InValue)) : Super(NAMESPACE_PRIVATE::OtherTupleConstructor, MoveTemp(InValue))
{ } { }
template <typename... OtherTypes> requires (sizeof...(OtherTypes) == ElementSize) template <typename... OtherTypes> requires (sizeof...(OtherTypes) == ElementSize)
&& (true && ... && CConstructible<Types, OtherTypes&&>) && (true && ... && CConstructible<Types, OtherTypes&&>)
&& ((ElementSize != 1) || !(TIsConvertible<TTuple<OtherTypes...>&&, typename TElementType<0>::Type>::Value && ((ElementSize != 1) || !(CConvertibleTo<TTuple<OtherTypes...>&&, typename TElementType<0>::Type>
|| CConstructible<typename TElementType<0>::Type, TTuple<OtherTypes...>&&> || CConstructible<typename TElementType<0>::Type, TTuple<OtherTypes...>&&>
|| TIsSame<typename TElementType<0>::Type, typename TTuple<OtherTypes...>::template TElementType<0>::Type>::Value)) || CSameAs<typename TElementType<0>::Type, typename TTuple<OtherTypes...>::template TElementType<0>::Type>))
&& (!(true && ... && TIsConvertible<OtherTypes&&, Types>::Value)) && (!(true && ... && CConvertibleTo<OtherTypes&&, Types>))
constexpr explicit TTuple(TTuple<OtherTypes...>&& InValue) constexpr explicit TTuple(TTuple<OtherTypes...>&& InValue)
: Super(NAMESPACE_PRIVATE::OtherTupleConstructor, MoveTemp(InValue)) : Super(NAMESPACE_PRIVATE::OtherTupleConstructor, MoveTemp(InValue))
{ } { }
@ -329,41 +329,41 @@ public:
template <typename T> requires (TElementIndex<T>::Value != INDEX_NONE) constexpr volatile T&& GetValue() volatile&& { return static_cast< volatile TTuple&&>(*this).GetValue<TElementIndex<T>::Value>(); } template <typename T> requires (TElementIndex<T>::Value != INDEX_NONE) constexpr volatile T&& GetValue() volatile&& { return static_cast< volatile TTuple&&>(*this).GetValue<TElementIndex<T>::Value>(); }
template <typename T> requires (TElementIndex<T>::Value != INDEX_NONE) constexpr const volatile T&& GetValue() const volatile&& { return static_cast<const volatile TTuple&&>(*this).GetValue<TElementIndex<T>::Value>(); } template <typename T> requires (TElementIndex<T>::Value != INDEX_NONE) constexpr const volatile T&& GetValue() const volatile&& { return static_cast<const volatile TTuple&&>(*this).GetValue<TElementIndex<T>::Value>(); }
template <typename F> requires TIsInvocable<F, Types...>::Value constexpr auto Apply(F&& Func) & { return Helper::Apply(Forward<F>(Func), static_cast< TTuple& >(*this)); } template <typename F> requires CInvocable<F, Types...> constexpr auto Apply(F&& Func) & { return Helper::Apply(Forward<F>(Func), static_cast< TTuple& >(*this)); }
template <typename F> requires TIsInvocable<F, Types...>::Value constexpr auto Apply(F&& Func) const & { return Helper::Apply(Forward<F>(Func), static_cast<const TTuple& >(*this)); } template <typename F> requires CInvocable<F, Types...> constexpr auto Apply(F&& Func) const & { return Helper::Apply(Forward<F>(Func), static_cast<const TTuple& >(*this)); }
template <typename F> requires TIsInvocable<F, Types...>::Value constexpr auto Apply(F&& Func) volatile& { return Helper::Apply(Forward<F>(Func), static_cast< volatile TTuple& >(*this)); } template <typename F> requires CInvocable<F, Types...> constexpr auto Apply(F&& Func) volatile& { return Helper::Apply(Forward<F>(Func), static_cast< volatile TTuple& >(*this)); }
template <typename F> requires TIsInvocable<F, Types...>::Value constexpr auto Apply(F&& Func) const volatile& { return Helper::Apply(Forward<F>(Func), static_cast<const volatile TTuple& >(*this)); } template <typename F> requires CInvocable<F, Types...> constexpr auto Apply(F&& Func) const volatile& { return Helper::Apply(Forward<F>(Func), static_cast<const volatile TTuple& >(*this)); }
template <typename F> requires TIsInvocable<F, Types...>::Value constexpr auto Apply(F&& Func) && { return Helper::Apply(Forward<F>(Func), static_cast< TTuple&&>(*this)); } template <typename F> requires CInvocable<F, Types...> constexpr auto Apply(F&& Func) && { return Helper::Apply(Forward<F>(Func), static_cast< TTuple&&>(*this)); }
template <typename F> requires TIsInvocable<F, Types...>::Value constexpr auto Apply(F&& Func) const && { return Helper::Apply(Forward<F>(Func), static_cast<const TTuple&&>(*this)); } template <typename F> requires CInvocable<F, Types...> constexpr auto Apply(F&& Func) const && { return Helper::Apply(Forward<F>(Func), static_cast<const TTuple&&>(*this)); }
template <typename F> requires TIsInvocable<F, Types...>::Value constexpr auto Apply(F&& Func) volatile&& { return Helper::Apply(Forward<F>(Func), static_cast< volatile TTuple&&>(*this)); } template <typename F> requires CInvocable<F, Types...> constexpr auto Apply(F&& Func) volatile&& { return Helper::Apply(Forward<F>(Func), static_cast< volatile TTuple&&>(*this)); }
template <typename F> requires TIsInvocable<F, Types...>::Value constexpr auto Apply(F&& Func) const volatile&& { return Helper::Apply(Forward<F>(Func), static_cast<const volatile TTuple&&>(*this)); } template <typename F> requires CInvocable<F, Types...> constexpr auto Apply(F&& Func) const volatile&& { return Helper::Apply(Forward<F>(Func), static_cast<const volatile TTuple&&>(*this)); }
template <typename F, typename... ArgTypes> requires TIsInvocable<F, ArgTypes..., Types...>::Value constexpr auto ApplyAfter(F&& Func, ArgTypes&&... Args) & { return Helper::ApplyAfter(Forward<F>(Func), static_cast< TTuple& >(*this), Forward<ArgTypes>(Args)...); } template <typename F, typename... ArgTypes> requires CInvocable<F, ArgTypes..., Types...> constexpr auto ApplyAfter(F&& Func, ArgTypes&&... Args) & { return Helper::ApplyAfter(Forward<F>(Func), static_cast< TTuple& >(*this), Forward<ArgTypes>(Args)...); }
template <typename F, typename... ArgTypes> requires TIsInvocable<F, ArgTypes..., Types...>::Value constexpr auto ApplyAfter(F&& Func, ArgTypes&&... Args) const & { return Helper::ApplyAfter(Forward<F>(Func), static_cast<const TTuple& >(*this), Forward<ArgTypes>(Args)...); } template <typename F, typename... ArgTypes> requires CInvocable<F, ArgTypes..., Types...> constexpr auto ApplyAfter(F&& Func, ArgTypes&&... Args) const & { return Helper::ApplyAfter(Forward<F>(Func), static_cast<const TTuple& >(*this), Forward<ArgTypes>(Args)...); }
template <typename F, typename... ArgTypes> requires TIsInvocable<F, ArgTypes..., Types...>::Value constexpr auto ApplyAfter(F&& Func, ArgTypes&&... Args) volatile& { return Helper::ApplyAfter(Forward<F>(Func), static_cast< volatile TTuple& >(*this), Forward<ArgTypes>(Args)...); } template <typename F, typename... ArgTypes> requires CInvocable<F, ArgTypes..., Types...> constexpr auto ApplyAfter(F&& Func, ArgTypes&&... Args) volatile& { return Helper::ApplyAfter(Forward<F>(Func), static_cast< volatile TTuple& >(*this), Forward<ArgTypes>(Args)...); }
template <typename F, typename... ArgTypes> requires TIsInvocable<F, ArgTypes..., Types...>::Value constexpr auto ApplyAfter(F&& Func, ArgTypes&&... Args) const volatile& { return Helper::ApplyAfter(Forward<F>(Func), static_cast<const volatile TTuple& >(*this), Forward<ArgTypes>(Args)...); } template <typename F, typename... ArgTypes> requires CInvocable<F, ArgTypes..., Types...> constexpr auto ApplyAfter(F&& Func, ArgTypes&&... Args) const volatile& { return Helper::ApplyAfter(Forward<F>(Func), static_cast<const volatile TTuple& >(*this), Forward<ArgTypes>(Args)...); }
template <typename F, typename... ArgTypes> requires TIsInvocable<F, ArgTypes..., Types...>::Value constexpr auto ApplyAfter(F&& Func, ArgTypes&&... Args) && { return Helper::ApplyAfter(Forward<F>(Func), static_cast< TTuple&&>(*this), Forward<ArgTypes>(Args)...); } template <typename F, typename... ArgTypes> requires CInvocable<F, ArgTypes..., Types...> constexpr auto ApplyAfter(F&& Func, ArgTypes&&... Args) && { return Helper::ApplyAfter(Forward<F>(Func), static_cast< TTuple&&>(*this), Forward<ArgTypes>(Args)...); }
template <typename F, typename... ArgTypes> requires TIsInvocable<F, ArgTypes..., Types...>::Value constexpr auto ApplyAfter(F&& Func, ArgTypes&&... Args) const && { return Helper::ApplyAfter(Forward<F>(Func), static_cast<const TTuple&&>(*this), Forward<ArgTypes>(Args)...); } template <typename F, typename... ArgTypes> requires CInvocable<F, ArgTypes..., Types...> constexpr auto ApplyAfter(F&& Func, ArgTypes&&... Args) const && { return Helper::ApplyAfter(Forward<F>(Func), static_cast<const TTuple&&>(*this), Forward<ArgTypes>(Args)...); }
template <typename F, typename... ArgTypes> requires TIsInvocable<F, ArgTypes..., Types...>::Value constexpr auto ApplyAfter(F&& Func, ArgTypes&&... Args) volatile&& { return Helper::ApplyAfter(Forward<F>(Func), static_cast< volatile TTuple&&>(*this), Forward<ArgTypes>(Args)...); } template <typename F, typename... ArgTypes> requires CInvocable<F, ArgTypes..., Types...> constexpr auto ApplyAfter(F&& Func, ArgTypes&&... Args) volatile&& { return Helper::ApplyAfter(Forward<F>(Func), static_cast< volatile TTuple&&>(*this), Forward<ArgTypes>(Args)...); }
template <typename F, typename... ArgTypes> requires TIsInvocable<F, ArgTypes..., Types...>::Value constexpr auto ApplyAfter(F&& Func, ArgTypes&&... Args) const volatile&& { return Helper::ApplyAfter(Forward<F>(Func), static_cast<const volatile TTuple&&>(*this), Forward<ArgTypes>(Args)...); } template <typename F, typename... ArgTypes> requires CInvocable<F, ArgTypes..., Types...> constexpr auto ApplyAfter(F&& Func, ArgTypes&&... Args) const volatile&& { return Helper::ApplyAfter(Forward<F>(Func), static_cast<const volatile TTuple&&>(*this), Forward<ArgTypes>(Args)...); }
template <typename F, typename... ArgTypes> requires TIsInvocable<F, Types..., ArgTypes...>::Value constexpr auto ApplyBefore(F&& Func, ArgTypes&&... Args) & { return Helper::ApplyBefore(Forward<F>(Func), static_cast< TTuple& >(*this), Forward<ArgTypes>(Args)...); } template <typename F, typename... ArgTypes> requires CInvocable<F, Types..., ArgTypes...> constexpr auto ApplyBefore(F&& Func, ArgTypes&&... Args) & { return Helper::ApplyBefore(Forward<F>(Func), static_cast< TTuple& >(*this), Forward<ArgTypes>(Args)...); }
template <typename F, typename... ArgTypes> requires TIsInvocable<F, Types..., ArgTypes...>::Value constexpr auto ApplyBefore(F&& Func, ArgTypes&&... Args) const & { return Helper::ApplyBefore(Forward<F>(Func), static_cast<const TTuple& >(*this), Forward<ArgTypes>(Args)...); } template <typename F, typename... ArgTypes> requires CInvocable<F, Types..., ArgTypes...> constexpr auto ApplyBefore(F&& Func, ArgTypes&&... Args) const & { return Helper::ApplyBefore(Forward<F>(Func), static_cast<const TTuple& >(*this), Forward<ArgTypes>(Args)...); }
template <typename F, typename... ArgTypes> requires TIsInvocable<F, Types..., ArgTypes...>::Value constexpr auto ApplyBefore(F&& Func, ArgTypes&&... Args) volatile& { return Helper::ApplyBefore(Forward<F>(Func), static_cast< volatile TTuple& >(*this), Forward<ArgTypes>(Args)...); } template <typename F, typename... ArgTypes> requires CInvocable<F, Types..., ArgTypes...> constexpr auto ApplyBefore(F&& Func, ArgTypes&&... Args) volatile& { return Helper::ApplyBefore(Forward<F>(Func), static_cast< volatile TTuple& >(*this), Forward<ArgTypes>(Args)...); }
template <typename F, typename... ArgTypes> requires TIsInvocable<F, Types..., ArgTypes...>::Value constexpr auto ApplyBefore(F&& Func, ArgTypes&&... Args) const volatile& { return Helper::ApplyBefore(Forward<F>(Func), static_cast<const volatile TTuple& >(*this), Forward<ArgTypes>(Args)...); } template <typename F, typename... ArgTypes> requires CInvocable<F, Types..., ArgTypes...> constexpr auto ApplyBefore(F&& Func, ArgTypes&&... Args) const volatile& { return Helper::ApplyBefore(Forward<F>(Func), static_cast<const volatile TTuple& >(*this), Forward<ArgTypes>(Args)...); }
template <typename F, typename... ArgTypes> requires TIsInvocable<F, Types..., ArgTypes...>::Value constexpr auto ApplyBefore(F&& Func, ArgTypes&&... Args) && { return Helper::ApplyBefore(Forward<F>(Func), static_cast< TTuple&&>(*this), Forward<ArgTypes>(Args)...); } template <typename F, typename... ArgTypes> requires CInvocable<F, Types..., ArgTypes...> constexpr auto ApplyBefore(F&& Func, ArgTypes&&... Args) && { return Helper::ApplyBefore(Forward<F>(Func), static_cast< TTuple&&>(*this), Forward<ArgTypes>(Args)...); }
template <typename F, typename... ArgTypes> requires TIsInvocable<F, Types..., ArgTypes...>::Value constexpr auto ApplyBefore(F&& Func, ArgTypes&&... Args) const && { return Helper::ApplyBefore(Forward<F>(Func), static_cast<const TTuple&&>(*this), Forward<ArgTypes>(Args)...); } template <typename F, typename... ArgTypes> requires CInvocable<F, Types..., ArgTypes...> constexpr auto ApplyBefore(F&& Func, ArgTypes&&... Args) const && { return Helper::ApplyBefore(Forward<F>(Func), static_cast<const TTuple&&>(*this), Forward<ArgTypes>(Args)...); }
template <typename F, typename... ArgTypes> requires TIsInvocable<F, Types..., ArgTypes...>::Value constexpr auto ApplyBefore(F&& Func, ArgTypes&&... Args) volatile&& { return Helper::ApplyBefore(Forward<F>(Func), static_cast< volatile TTuple&&>(*this), Forward<ArgTypes>(Args)...); } template <typename F, typename... ArgTypes> requires CInvocable<F, Types..., ArgTypes...> constexpr auto ApplyBefore(F&& Func, ArgTypes&&... Args) volatile&& { return Helper::ApplyBefore(Forward<F>(Func), static_cast< volatile TTuple&&>(*this), Forward<ArgTypes>(Args)...); }
template <typename F, typename... ArgTypes> requires TIsInvocable<F, Types..., ArgTypes...>::Value constexpr auto ApplyBefore(F&& Func, ArgTypes&&... Args) const volatile&& { return Helper::ApplyBefore(Forward<F>(Func), static_cast<const volatile TTuple&&>(*this), Forward<ArgTypes>(Args)...); } template <typename F, typename... ArgTypes> requires CInvocable<F, Types..., ArgTypes...> constexpr auto ApplyBefore(F&& Func, ArgTypes&&... Args) const volatile&& { return Helper::ApplyBefore(Forward<F>(Func), static_cast<const volatile TTuple&&>(*this), Forward<ArgTypes>(Args)...); }
template <typename F> requires (true && ... && (TIsInvocable<F, Types>::Value && !TIsSame<void, typename TInvokeResult<F, Types>::Type>::Value)) constexpr auto Transform(F&& Func) & { return Helper::Transform(Forward<F>(Func), static_cast< TTuple& >(*this)); } template <typename F> requires (true && ... && (CInvocable<F, Types> && !CSameAs<void, typename TInvokeResult<F, Types>::Type>)) constexpr auto Transform(F&& Func) & { return Helper::Transform(Forward<F>(Func), static_cast< TTuple& >(*this)); }
template <typename F> requires (true && ... && (TIsInvocable<F, Types>::Value && !TIsSame<void, typename TInvokeResult<F, Types>::Type>::Value)) constexpr auto Transform(F&& Func) const & { return Helper::Transform(Forward<F>(Func), static_cast<const TTuple& >(*this)); } template <typename F> requires (true && ... && (CInvocable<F, Types> && !CSameAs<void, typename TInvokeResult<F, Types>::Type>)) constexpr auto Transform(F&& Func) const & { return Helper::Transform(Forward<F>(Func), static_cast<const TTuple& >(*this)); }
template <typename F> requires (true && ... && (TIsInvocable<F, Types>::Value && !TIsSame<void, typename TInvokeResult<F, Types>::Type>::Value)) constexpr auto Transform(F&& Func) volatile& { return Helper::Transform(Forward<F>(Func), static_cast< volatile TTuple& >(*this)); } template <typename F> requires (true && ... && (CInvocable<F, Types> && !CSameAs<void, typename TInvokeResult<F, Types>::Type>)) constexpr auto Transform(F&& Func) volatile& { return Helper::Transform(Forward<F>(Func), static_cast< volatile TTuple& >(*this)); }
template <typename F> requires (true && ... && (TIsInvocable<F, Types>::Value && !TIsSame<void, typename TInvokeResult<F, Types>::Type>::Value)) constexpr auto Transform(F&& Func) const volatile& { return Helper::Transform(Forward<F>(Func), static_cast<const volatile TTuple& >(*this)); } template <typename F> requires (true && ... && (CInvocable<F, Types> && !CSameAs<void, typename TInvokeResult<F, Types>::Type>)) constexpr auto Transform(F&& Func) const volatile& { return Helper::Transform(Forward<F>(Func), static_cast<const volatile TTuple& >(*this)); }
template <typename F> requires (true && ... && (TIsInvocable<F, Types>::Value && !TIsSame<void, typename TInvokeResult<F, Types>::Type>::Value)) constexpr auto Transform(F&& Func) && { return Helper::Transform(Forward<F>(Func), static_cast< TTuple&&>(*this)); } template <typename F> requires (true && ... && (CInvocable<F, Types> && !CSameAs<void, typename TInvokeResult<F, Types>::Type>)) constexpr auto Transform(F&& Func) && { return Helper::Transform(Forward<F>(Func), static_cast< TTuple&&>(*this)); }
template <typename F> requires (true && ... && (TIsInvocable<F, Types>::Value && !TIsSame<void, typename TInvokeResult<F, Types>::Type>::Value)) constexpr auto Transform(F&& Func) const && { return Helper::Transform(Forward<F>(Func), static_cast<const TTuple&&>(*this)); } template <typename F> requires (true && ... && (CInvocable<F, Types> && !CSameAs<void, typename TInvokeResult<F, Types>::Type>)) constexpr auto Transform(F&& Func) const && { return Helper::Transform(Forward<F>(Func), static_cast<const TTuple&&>(*this)); }
template <typename F> requires (true && ... && (TIsInvocable<F, Types>::Value && !TIsSame<void, typename TInvokeResult<F, Types>::Type>::Value)) constexpr auto Transform(F&& Func) volatile&& { return Helper::Transform(Forward<F>(Func), static_cast< volatile TTuple&&>(*this)); } template <typename F> requires (true && ... && (CInvocable<F, Types> && !CSameAs<void, typename TInvokeResult<F, Types>::Type>)) constexpr auto Transform(F&& Func) volatile&& { return Helper::Transform(Forward<F>(Func), static_cast< volatile TTuple&&>(*this)); }
template <typename F> requires (true && ... && (TIsInvocable<F, Types>::Value && !TIsSame<void, typename TInvokeResult<F, Types>::Type>::Value)) constexpr auto Transform(F&& Func) const volatile&& { return Helper::Transform(Forward<F>(Func), static_cast<const volatile TTuple&&>(*this)); } template <typename F> requires (true && ... && (CInvocable<F, Types> && !CSameAs<void, typename TInvokeResult<F, Types>::Type>)) constexpr auto Transform(F&& Func) const volatile&& { return Helper::Transform(Forward<F>(Func), static_cast<const volatile TTuple&&>(*this)); }
template <typename T> requires CConstructible<T, Types...> constexpr T Construct() & { return Helper::template Construct<T>(static_cast< TTuple& >(*this)); } template <typename T> requires CConstructible<T, Types...> constexpr T Construct() & { return Helper::template Construct<T>(static_cast< TTuple& >(*this)); }
template <typename T> requires CConstructible<T, Types...> constexpr T Construct() const & { return Helper::template Construct<T>(static_cast<const TTuple& >(*this)); } template <typename T> requires CConstructible<T, Types...> constexpr T Construct() const & { return Helper::template Construct<T>(static_cast<const TTuple& >(*this)); }
@ -565,7 +565,7 @@ constexpr typename TCommonComparisonCategory<typename TSynthThreeWayResult<LHSTy
return NAMESPACE_PRIVATE::TTupleThreeWay<R, TMakeIndexSequence<sizeof...(LHSTypes)>>::F(LHS, RHS); return NAMESPACE_PRIVATE::TTupleThreeWay<R, TMakeIndexSequence<sizeof...(LHSTypes)>>::F(LHS, RHS);
} }
template <typename F> requires TIsInvocable<F>::Value template <typename F> requires CInvocable<F>
constexpr void VisitTuple(F&& Func) { } constexpr void VisitTuple(F&& Func) { }
template <typename F, typename FirstTupleType, typename... TupleTypes> template <typename F, typename FirstTupleType, typename... TupleTypes>

View File

@ -40,7 +40,7 @@ constexpr size_t HashCombine(size_t A, size_t C)
return C; return C;
} }
template <typename... Ts> requires (true && ... && TIsConvertible<Ts, size_t>::Value) template <typename... Ts> requires (true && ... && CConvertibleTo<Ts, size_t>)
constexpr size_t HashCombine(size_t A, size_t C, Ts... InOther) constexpr size_t HashCombine(size_t A, size_t C, Ts... InOther)
{ {
size_t B = HashCombine(A, C); size_t B = HashCombine(A, C);
@ -81,7 +81,7 @@ constexpr size_t GetTypeHash(T A)
return GetTypeHash(static_cast<typename TUnderlyingType<T>::Type>(A)); return GetTypeHash(static_cast<typename TUnderlyingType<T>::Type>(A));
} }
template <typename T> requires CPointer<T> || TIsSame<T, nullptr_t>::Value template <typename T> requires CPointer<T> || CSameAs<T, nullptr_t>
constexpr size_t GetTypeHash(T A) constexpr size_t GetTypeHash(T A)
{ {
return GetTypeHash(reinterpret_cast<intptr>(A)); return GetTypeHash(reinterpret_cast<intptr>(A));

View File

@ -20,7 +20,7 @@ struct TVariantAlternativeIndex;
template <typename T, typename U, typename... Types> template <typename T, typename U, typename... Types>
struct TVariantAlternativeIndex<T, U, Types...> struct TVariantAlternativeIndex<T, U, Types...>
: TConstant<size_t, TIsSame<T, U>::Value ? 0 : (TVariantAlternativeIndex<T, Types...>::Value == INDEX_NONE : TConstant<size_t, CSameAs<T, U> ? 0 : (TVariantAlternativeIndex<T, Types...>::Value == INDEX_NONE
? INDEX_NONE : TVariantAlternativeIndex<T, Types...>::Value + 1)> ? INDEX_NONE : TVariantAlternativeIndex<T, Types...>::Value + 1)>
{ }; { };
@ -52,18 +52,18 @@ struct TVariantSelectedType<T, U, Types...>
using TypeAlternativeA = typename TConditional<CConstructible<U, T&&>, U, void>::Type; using TypeAlternativeA = typename TConditional<CConstructible<U, T&&>, U, void>::Type;
using TypeAlternativeB = typename TVariantSelectedType<T, Types...>::Type; using TypeAlternativeB = typename TVariantSelectedType<T, Types...>::Type;
using Type = typename TConditional<TIsSame<typename TRemoveCVRef<TypeAlternativeA>::Type, void>::Value, TypeAlternativeB, using Type = typename TConditional<CSameAs<typename TRemoveCVRef<TypeAlternativeA>::Type, void>, TypeAlternativeB,
typename TConditional<TIsSame<typename TRemoveCVRef<TypeAlternativeB>::Type, void>::Value, TypeAlternativeA, typename TConditional<CSameAs<typename TRemoveCVRef<TypeAlternativeB>::Type, void>, TypeAlternativeA,
typename TConditional<TIsSame<typename TRemoveCVRef<TypeAlternativeB>::Type, typename TRemoveCVRef<T>::Type>::Value, TypeAlternativeB, TypeAlternativeA>::Type>::Type>::Type; typename TConditional<CSameAs<typename TRemoveCVRef<TypeAlternativeB>::Type, typename TRemoveCVRef<T>::Type>, TypeAlternativeB, TypeAlternativeA>::Type>::Type>::Type;
// 0 - Type not found // 0 - Type not found
// 1 - Same type found // 1 - Same type found
// 2 - Multiple types found // 2 - Multiple types found
// 3 - The type found // 3 - The type found
static constexpr uint8 Flag = TIsSame<typename TRemoveCVRef<Type>::Type, void>::Value ? 0 : static constexpr uint8 Flag = CSameAs<typename TRemoveCVRef<Type>::Type, void> ? 0 :
TIsSame<typename TRemoveCVRef<TypeAlternativeA>::Type, typename TRemoveCVRef<TypeAlternativeB>::Type>::Value ? 2 : CSameAs<typename TRemoveCVRef<TypeAlternativeA>::Type, typename TRemoveCVRef<TypeAlternativeB>::Type> ? 2 :
TIsSame<typename TRemoveCVRef< Type>::Type, typename TRemoveCVRef< T>::Type>::Value ? 1 : CSameAs<typename TRemoveCVRef< Type>::Type, typename TRemoveCVRef< T>::Type> ? 1 :
!TIsSame<typename TRemoveCVRef<TypeAlternativeA>::Type, void>::Value && !TIsSame<TypeAlternativeB, void>::Value ? 2 : 3; !CSameAs<typename TRemoveCVRef<TypeAlternativeA>::Type, void> && !CSameAs<TypeAlternativeB, void> ? 2 : 3;
static constexpr bool Value = Flag & 1; static constexpr bool Value = Flag & 1;
@ -119,7 +119,7 @@ struct TVariant
template <typename T> requires NAMESPACE_PRIVATE::TVariantSelectedType<typename TRemoveReference<T>::Type, Types...>::Value template <typename T> requires NAMESPACE_PRIVATE::TVariantSelectedType<typename TRemoveReference<T>::Type, Types...>::Value
&& (!TIsTInPlaceType<typename TRemoveCVRef<T>::Type>::Value) && (!TIsTInPlaceIndex<typename TRemoveCVRef<T>::Type>::Value) && (!TIsTInPlaceType<typename TRemoveCVRef<T>::Type>::Value) && (!TIsTInPlaceIndex<typename TRemoveCVRef<T>::Type>::Value)
&& (!TIsSame<typename TRemoveCVRef<T>::Type, TVariant>::Value) && (!CSameAs<typename TRemoveCVRef<T>::Type, TVariant>)
constexpr TVariant(T&& InValue) : TVariant(InPlaceType<typename NAMESPACE_PRIVATE::TVariantSelectedType<typename TRemoveReference<T>::Type, Types...>::Type>, Forward<T>(InValue)) constexpr TVariant(T&& InValue) : TVariant(InPlaceType<typename NAMESPACE_PRIVATE::TVariantSelectedType<typename TRemoveReference<T>::Type, Types...>::Type>, Forward<T>(InValue))
{ } { }
@ -231,7 +231,7 @@ struct TVariant
template <typename T> requires (TAlternativeIndex<T>::Value != INDEX_NONE) constexpr T& Get(T& DefaultValue)& { return HoldsAlternative<T>() ? GetValue<T>() : DefaultValue; } template <typename T> requires (TAlternativeIndex<T>::Value != INDEX_NONE) constexpr T& Get(T& DefaultValue)& { return HoldsAlternative<T>() ? GetValue<T>() : DefaultValue; }
template <typename T> requires (TAlternativeIndex<T>::Value != INDEX_NONE) constexpr const T& Get(const T& DefaultValue) const& { return HoldsAlternative<T>() ? GetValue<T>() : DefaultValue; } template <typename T> requires (TAlternativeIndex<T>::Value != INDEX_NONE) constexpr const T& Get(const T& DefaultValue) const& { return HoldsAlternative<T>() ? GetValue<T>() : DefaultValue; }
template <typename F> requires (true && ... && TIsInvocable<F, Types>::Value) template <typename F> requires (true && ... && CInvocable<F, Types>)
FORCEINLINE decltype(auto) Visit(F&& Func) & FORCEINLINE decltype(auto) Visit(F&& Func) &
{ {
checkf(IsValid(), TEXT("It is an error to call Visit() on an wrong TVariant. Please either check IsValid().")); checkf(IsValid(), TEXT("It is an error to call Visit() on an wrong TVariant. Please either check IsValid()."));
@ -244,7 +244,7 @@ struct TVariant
return InvokeImpl[GetIndex()](Forward<F>(Func), &Value); return InvokeImpl[GetIndex()](Forward<F>(Func), &Value);
} }
template <typename F> requires (true && ... && TIsInvocable<F, Types>::Value) template <typename F> requires (true && ... && CInvocable<F, Types>)
FORCEINLINE decltype(auto) Visit(F&& Func) && FORCEINLINE decltype(auto) Visit(F&& Func) &&
{ {
checkf(IsValid(), TEXT("It is an error to call Visit() on an wrong TVariant. Please either check IsValid().")); checkf(IsValid(), TEXT("It is an error to call Visit() on an wrong TVariant. Please either check IsValid()."));
@ -257,7 +257,7 @@ struct TVariant
return InvokeImpl[GetIndex()](Forward<F>(Func), &Value); return InvokeImpl[GetIndex()](Forward<F>(Func), &Value);
} }
template <typename F> requires (true && ... && TIsInvocable<F, Types>::Value) template <typename F> requires (true && ... && CInvocable<F, Types>)
FORCEINLINE decltype(auto) Visit(F&& Func) const& FORCEINLINE decltype(auto) Visit(F&& Func) const&
{ {
checkf(IsValid(), TEXT("It is an error to call Visit() on an wrong TVariant. Please either check IsValid().")); checkf(IsValid(), TEXT("It is an error to call Visit() on an wrong TVariant. Please either check IsValid()."));
@ -270,7 +270,7 @@ struct TVariant
return InvokeImpl[GetIndex()](Forward<F>(Func), &Value); return InvokeImpl[GetIndex()](Forward<F>(Func), &Value);
} }
template <typename F> requires (true && ... && TIsInvocable<F, Types>::Value) template <typename F> requires (true && ... && CInvocable<F, Types>)
FORCEINLINE decltype(auto) Visit(F&& Func) const&& FORCEINLINE decltype(auto) Visit(F&& Func) const&&
{ {
checkf(IsValid(), TEXT("It is an error to call Visit() on an wrong TVariant. Please either check IsValid().")); checkf(IsValid(), TEXT("It is an error to call Visit() on an wrong TVariant. Please either check IsValid()."));
@ -283,16 +283,16 @@ struct TVariant
return InvokeImpl[GetIndex()](Forward<F>(Func), &Value); return InvokeImpl[GetIndex()](Forward<F>(Func), &Value);
} }
template <typename R, typename F> requires (true && ... && TIsInvocableResult<R, F, Types>::Value) template <typename R, typename F> requires (true && ... && CInvocableResult<R, F, Types>)
FORCEINLINE R Visit(F&& Func) & { return Visit(Forward<F>(Func)); } FORCEINLINE R Visit(F&& Func) & { return Visit(Forward<F>(Func)); }
template <typename R, typename F> requires (true && ... && TIsInvocableResult<R, F, Types>::Value) template <typename R, typename F> requires (true && ... && CInvocableResult<R, F, Types>)
FORCEINLINE R Visit(F&& Func) && { return MoveTemp(*this).Visit(Forward<F>(Func)); } FORCEINLINE R Visit(F&& Func) && { return MoveTemp(*this).Visit(Forward<F>(Func)); }
template <typename R, typename F> requires (true && ... && TIsInvocableResult<R, F, Types>::Value) template <typename R, typename F> requires (true && ... && CInvocableResult<R, F, Types>)
FORCEINLINE R Visit(F&& Func) const& { return Visit(Forward<F>(Func)); } FORCEINLINE R Visit(F&& Func) const& { return Visit(Forward<F>(Func)); }
template <typename R, typename F> requires (true && ... && TIsInvocableResult<R, F, Types>::Value) template <typename R, typename F> requires (true && ... && CInvocableResult<R, F, Types>)
FORCEINLINE R Visit(F&& Func) const&& { return MoveTemp(*this).Visit(Forward<F>(Func)); } FORCEINLINE R Visit(F&& Func) const&& { return MoveTemp(*this).Visit(Forward<F>(Func)); }
constexpr void Reset() constexpr void Reset()
@ -397,7 +397,7 @@ private:
}; };
template <typename T, typename... Types> requires (!TIsSame<T, TVariant<Types...>>::Value) && CEqualityComparable<T> template <typename T, typename... Types> requires (!CSameAs<T, TVariant<Types...>>) && CEqualityComparable<T>
constexpr bool operator==(const TVariant<Types...>& LHS, const T& RHS) constexpr bool operator==(const TVariant<Types...>& LHS, const T& RHS)
{ {
return LHS.template HoldsAlternative<T>() ? LHS.template GetValue<T>() == RHS : false; return LHS.template HoldsAlternative<T>() ? LHS.template GetValue<T>() == RHS : false;

View File

@ -35,9 +35,9 @@ template <typename T, typename U> struct TIsBitwiseConstructible<const volatile
template <typename T, typename U> struct TIsBitwiseConstructible<const volatile T, volatile U> : TIsBitwiseConstructible<T, U> { }; template <typename T, typename U> struct TIsBitwiseConstructible<const volatile T, volatile U> : TIsBitwiseConstructible<T, U> { };
template <typename T, typename U> struct TIsBitwiseConstructible<const volatile T, const volatile U> : TIsBitwiseConstructible<T, U> { }; template <typename T, typename U> struct TIsBitwiseConstructible<const volatile T, const volatile U> : TIsBitwiseConstructible<T, U> { };
template <typename T, typename U> struct TIsBitwiseConstructible<T*, U*> : TIsConvertible<U*, T*> { }; template <typename T, typename U> struct TIsBitwiseConstructible<T*, U*> : TBoolConstant<CConvertibleTo<U*, T*>> { };
template <typename T, typename U> struct TIsBitwiseConstructible : TBoolConstant<TIsSame<T, U>::Value ? CTriviallyCopyConstructible<T> : false> { }; template <typename T, typename U> struct TIsBitwiseConstructible : TBoolConstant<CSameAs<T, U> ? CTriviallyCopyConstructible<T> : false> { };
template <> struct TIsBitwiseConstructible<uint8, int8> : FTrue { }; template <> struct TIsBitwiseConstructible<uint8, int8> : FTrue { };
template <> struct TIsBitwiseConstructible< int8, uint8> : FTrue { }; template <> struct TIsBitwiseConstructible< int8, uint8> : FTrue { };

View File

@ -0,0 +1,17 @@
#pragma once
#include "CoreTypes.h"
#include "Templates/Utility.h"
#include "TypeTraits/Miscellaneous.h"
NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility)
template <typename T>
concept CBooleanTestable = CConvertibleTo<T, bool> &&
requires(T && B) { { !Forward<T>(B) } -> CConvertibleTo<bool>; };
NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END

View File

@ -0,0 +1,36 @@
#pragma once
#include "CoreTypes.h"
#include "TypeTraits/BooleanTestable.h"
#include <type_traits>
NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility)
template <typename F, typename... Args> concept CInvocable = NAMESPACE_STD::is_invocable_v<F, Args...>;
template <typename R, typename F, typename... Args> concept CInvocableResult = NAMESPACE_STD::is_invocable_r_v<R, F, Args...>; // FIXME: The result for char(&())[2] is wrong on MSVC
template <typename F, typename... Args> struct TInvokeResult { using Type = NAMESPACE_STD::invoke_result_t<F, Args...>; }; // FIXME: The result for char(&())[2] is wrong on MSVC
template <typename F, typename... Types>
concept CRegularInvocable = CInvocable<F, Types...>;
template <typename F, typename... Types>
concept CPredicate = CRegularInvocable<F, Types...> && CBooleanTestable<typename TInvokeResult<F, Types...>::Type>;
template <typename R, typename T, typename U>
concept CRelation =
CPredicate<R, T, T> && CPredicate<R, U, U> &&
CPredicate<R, T, U> && CPredicate<R, U, T>;
template <typename R, typename T, typename U>
concept CEquivalenceRelation = CRelation<R, T, U>;
template <typename R, typename T, typename U>
concept CStrictWeakOrder = CRelation<R, T, U>;
NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft)
NAMESPACE_REDCRAFT_END

View File

@ -25,14 +25,12 @@ struct TMaximum<First, Second, Others...> : TMaximum<(First < Second ? Second :
NAMESPACE_PRIVATE_END NAMESPACE_PRIVATE_END
template <typename T> struct TRank : TConstant<size_t, NAMESPACE_STD::rank_v<T>> { }; template <typename T> inline constexpr size_t ArrayRank = NAMESPACE_STD::rank_v<T>;
template <typename T, size_t I = 0> struct TExtent : TConstant<size_t, NAMESPACE_STD::extent_v<T, I>> { }; template <typename T, size_t I = 0> inline constexpr size_t ArrayExtent = NAMESPACE_STD::extent_v<T, I>;
template <typename T, typename U> struct TIsSame : TBoolConstant<NAMESPACE_STD::is_same_v<T, U>> { }; template <typename T, typename U> concept CSameAs = NAMESPACE_STD::is_same_v<T, U>;
template <typename T, typename U> struct TIsBaseOf : TBoolConstant<NAMESPACE_STD::is_base_of_v<T, U>> { }; template <typename T, typename U> concept CBaseOf = NAMESPACE_STD::is_base_of_v<T, U>;
template <typename T, typename U> struct TIsConvertible : TBoolConstant<NAMESPACE_STD::is_convertible_v<T, U>> { }; template <typename T, typename U> concept CConvertibleTo = NAMESPACE_STD::is_convertible_v<T, U>;
template <typename F, typename... Args> struct TIsInvocable : TBoolConstant<NAMESPACE_STD::is_invocable_v<F, Args...>> { };
template <typename R, typename F, typename... Args> struct TIsInvocableResult : TBoolConstant<NAMESPACE_STD::is_invocable_r_v<R, F, Args...>> { }; // FIXME: The result for char(&())[2] is wrong on MSVC
template <typename T> struct TRemoveConst { using Type = NAMESPACE_STD::remove_const_t<T>; }; template <typename T> struct TRemoveConst { using Type = NAMESPACE_STD::remove_const_t<T>; };
template <typename T> struct TRemoveVolatile { using Type = NAMESPACE_STD::remove_volatile_t<T>; }; template <typename T> struct TRemoveVolatile { using Type = NAMESPACE_STD::remove_volatile_t<T>; };
@ -52,7 +50,6 @@ template <typename T> struct TDecay { using Type =
template <bool B, typename T = void> struct TEnableIf { using Type = NAMESPACE_STD::enable_if_t<B, T>; }; template <bool B, typename T = void> struct TEnableIf { using Type = NAMESPACE_STD::enable_if_t<B, T>; };
template <bool B, typename T, typename F> struct TConditional { using Type = NAMESPACE_STD::conditional_t<B, T, F>; }; template <bool B, typename T, typename F> struct TConditional { using Type = NAMESPACE_STD::conditional_t<B, T, F>; };
template <typename T> struct TUnderlyingType { using Type = NAMESPACE_STD::underlying_type_t<T>; }; template <typename T> struct TUnderlyingType { using Type = NAMESPACE_STD::underlying_type_t<T>; };
template <typename F, typename... Args> struct TInvokeResult { using Type = NAMESPACE_STD::invoke_result_t<F, Args...>; }; // FIXME: The result for char(&())[2] is wrong on MSVC
template <typename... Types> struct TVoid { using Type = void; }; template <typename... Types> struct TVoid { using Type = void; };
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)

View File

@ -1,7 +1,6 @@
#pragma once #pragma once
#include "CoreTypes.h" #include "CoreTypes.h"
#include "TypeTraits/HelperClasses.h"
#include <type_traits> #include <type_traits>

View File

@ -25,7 +25,7 @@ template <typename T> concept CSigned = NAMESPACE_STD::is_sig
template <typename T> concept CUnsigned = NAMESPACE_STD::is_unsigned_v<T>; template <typename T> concept CUnsigned = NAMESPACE_STD::is_unsigned_v<T>;
template <typename T> concept CBoundedArray = NAMESPACE_STD::is_bounded_array_v<T>; template <typename T> concept CBoundedArray = NAMESPACE_STD::is_bounded_array_v<T>;
template <typename T> concept CUnboundedArray = NAMESPACE_STD::is_unbounded_array_v<T>; template <typename T> concept CUnboundedArray = NAMESPACE_STD::is_unbounded_array_v<T>;
template <typename T> concept CScopedEnum = CEnum<T> && !TIsConvertible<T, int64>::Value; template <typename T> concept CScopedEnum = CEnum<T> && !CConvertibleTo<T, int64>;
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft) NAMESPACE_MODULE_END(Redcraft)

View File

@ -7,8 +7,10 @@
#include "TypeTraits/TypeProperties.h" #include "TypeTraits/TypeProperties.h"
#include "TypeTraits/SupportedOperations.h" #include "TypeTraits/SupportedOperations.h"
#include "TypeTraits/Miscellaneous.h" #include "TypeTraits/Miscellaneous.h"
#include "TypeTraits/Invocable.h"
#include "TypeTraits/Swappable.h" #include "TypeTraits/Swappable.h"
#include "TypeTraits/Common.h" #include "TypeTraits/Common.h"
#include "TypeTraits/CopyQualifiers.h" #include "TypeTraits/CopyQualifiers.h"
#include "TypeTraits/InPlaceSpecialization.h" #include "TypeTraits/InPlaceSpecialization.h"
#include "TypeTraits/BitwiseOperations.h" #include "TypeTraits/BitwiseOperations.h"
#include "TypeTraits/BooleanTestable.h"