diff --git a/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp b/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp index 28b1dd2..54083fe 100644 --- a/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp +++ b/Redcraft.Utility/Source/Private/Testing/TypeTraitsTesting.cpp @@ -438,9 +438,9 @@ void TestTypeTraits() always_check(!(CInvocableResult)); always_check(!(CInvocableResult)); - always_check((CSameAs::Type>)); - always_check((CSameAs::Type>)); -// always_check((CSameAs::Type>)); + always_check((CSameAs>)); + always_check((CSameAs>)); +// always_check((CSameAs>)); always_check((CInvocable void { }) >)); always_check((CRegularInvocable int32 { return A; }), int32 >)); diff --git a/Redcraft.Utility/Source/Public/Templates/Tuple.h b/Redcraft.Utility/Source/Public/Templates/Tuple.h index e1252b7..42e13aa 100644 --- a/Redcraft.Utility/Source/Public/Templates/Tuple.h +++ b/Redcraft.Utility/Source/Public/Templates/Tuple.h @@ -356,14 +356,14 @@ public: template requires CInvocable constexpr auto ApplyBefore(F&& Func, ArgTypes&&... Args) volatile&& { return Helper::ApplyBefore(Forward(Func), static_cast< volatile TTuple&&>(*this), Forward(Args)...); } template requires CInvocable constexpr auto ApplyBefore(F&& Func, ArgTypes&&... Args) const volatile&& { return Helper::ApplyBefore(Forward(Func), static_cast(*this), Forward(Args)...); } - template requires (true && ... && (CInvocable && !CSameAs::Type>)) constexpr auto Transform(F&& Func) & { return Helper::Transform(Forward(Func), static_cast< TTuple& >(*this)); } - template requires (true && ... && (CInvocable && !CSameAs::Type>)) constexpr auto Transform(F&& Func) const & { return Helper::Transform(Forward(Func), static_cast(*this)); } - template requires (true && ... && (CInvocable && !CSameAs::Type>)) constexpr auto Transform(F&& Func) volatile& { return Helper::Transform(Forward(Func), static_cast< volatile TTuple& >(*this)); } - template requires (true && ... && (CInvocable && !CSameAs::Type>)) constexpr auto Transform(F&& Func) const volatile& { return Helper::Transform(Forward(Func), static_cast(*this)); } - template requires (true && ... && (CInvocable && !CSameAs::Type>)) constexpr auto Transform(F&& Func) && { return Helper::Transform(Forward(Func), static_cast< TTuple&&>(*this)); } - template requires (true && ... && (CInvocable && !CSameAs::Type>)) constexpr auto Transform(F&& Func) const && { return Helper::Transform(Forward(Func), static_cast(*this)); } - template requires (true && ... && (CInvocable && !CSameAs::Type>)) constexpr auto Transform(F&& Func) volatile&& { return Helper::Transform(Forward(Func), static_cast< volatile TTuple&&>(*this)); } - template requires (true && ... && (CInvocable && !CSameAs::Type>)) constexpr auto Transform(F&& Func) const volatile&& { return Helper::Transform(Forward(Func), static_cast(*this)); } + template requires (true && ... && (CInvocable && !CSameAs>)) constexpr auto Transform(F&& Func) & { return Helper::Transform(Forward(Func), static_cast< TTuple& >(*this)); } + template requires (true && ... && (CInvocable && !CSameAs>)) constexpr auto Transform(F&& Func) const & { return Helper::Transform(Forward(Func), static_cast(*this)); } + template requires (true && ... && (CInvocable && !CSameAs>)) constexpr auto Transform(F&& Func) volatile& { return Helper::Transform(Forward(Func), static_cast< volatile TTuple& >(*this)); } + template requires (true && ... && (CInvocable && !CSameAs>)) constexpr auto Transform(F&& Func) const volatile& { return Helper::Transform(Forward(Func), static_cast(*this)); } + template requires (true && ... && (CInvocable && !CSameAs>)) constexpr auto Transform(F&& Func) && { return Helper::Transform(Forward(Func), static_cast< TTuple&&>(*this)); } + template requires (true && ... && (CInvocable && !CSameAs>)) constexpr auto Transform(F&& Func) const && { return Helper::Transform(Forward(Func), static_cast(*this)); } + template requires (true && ... && (CInvocable && !CSameAs>)) constexpr auto Transform(F&& Func) volatile&& { return Helper::Transform(Forward(Func), static_cast< volatile TTuple&&>(*this)); } + template requires (true && ... && (CInvocable && !CSameAs>)) constexpr auto Transform(F&& Func) const volatile&& { return Helper::Transform(Forward(Func), static_cast(*this)); } template requires CConstructibleFrom constexpr T Construct() & { return Helper::template Construct(static_cast< TTuple& >(*this)); } template requires CConstructibleFrom constexpr T Construct() const & { return Helper::template Construct(static_cast(*this)); } diff --git a/Redcraft.Utility/Source/Public/Templates/Variant.h b/Redcraft.Utility/Source/Public/Templates/Variant.h index 7e84454..07ae9f8 100644 --- a/Redcraft.Utility/Source/Public/Templates/Variant.h +++ b/Redcraft.Utility/Source/Public/Templates/Variant.h @@ -236,7 +236,7 @@ struct TVariant { checkf(IsValid(), TEXT("It is an error to call Visit() on an wrong TVariant. Please either check IsValid().")); - using ReturnType = typename TCommonType::Type...>::Type; + using ReturnType = typename TCommonType...>::Type; using FInvokeImpl = ReturnType(*)(F&&, void*); static constexpr FInvokeImpl InvokeImpl[] = { [](F&& Func, void* This) -> ReturnType { return InvokeResult(Forward(Func), *reinterpret_cast(This)); }... }; @@ -249,7 +249,7 @@ struct TVariant { checkf(IsValid(), TEXT("It is an error to call Visit() on an wrong TVariant. Please either check IsValid().")); - using ReturnType = typename TCommonType::Type...>::Type; + using ReturnType = typename TCommonType...>::Type; using FInvokeImpl = ReturnType(*)(F&&, void*); static constexpr FInvokeImpl InvokeImpl[] = { [](F&& Func, void* This) -> ReturnType { return InvokeResult(Forward(Func), MoveTemp(*reinterpret_cast(This))); }... }; @@ -262,7 +262,7 @@ struct TVariant { checkf(IsValid(), TEXT("It is an error to call Visit() on an wrong TVariant. Please either check IsValid().")); - using ReturnType = typename TCommonType::Type...>::Type; + using ReturnType = typename TCommonType...>::Type; using FInvokeImpl = ReturnType(*)(F&&, const void*); static constexpr FInvokeImpl InvokeImpl[] = { [](F&& Func, const void* This) -> ReturnType { return InvokeResult(Forward(Func), *reinterpret_cast(This)); }... }; @@ -275,7 +275,7 @@ struct TVariant { checkf(IsValid(), TEXT("It is an error to call Visit() on an wrong TVariant. Please either check IsValid().")); - using ReturnType = typename TCommonType::Type...>::Type; + using ReturnType = typename TCommonType...>::Type; using FInvokeImpl = ReturnType(*)(F&&, const void*); static constexpr FInvokeImpl InvokeImpl[] = { [](F&& Func, const void* This) -> ReturnType { return InvokeResult(Forward(Func), MoveTemp(*reinterpret_cast(This))); }... }; diff --git a/Redcraft.Utility/Source/Public/TypeTraits/Invocable.h b/Redcraft.Utility/Source/Public/TypeTraits/Invocable.h index dadf4ee..7f02460 100644 --- a/Redcraft.Utility/Source/Public/TypeTraits/Invocable.h +++ b/Redcraft.Utility/Source/Public/TypeTraits/Invocable.h @@ -12,13 +12,13 @@ NAMESPACE_MODULE_BEGIN(Utility) template concept CInvocable = NAMESPACE_STD::is_invocable_v; template concept CInvocableResult = NAMESPACE_STD::is_invocable_r_v; // FIXME: The result for char(&())[2] is wrong on MSVC -template struct TInvokeResult { using Type = NAMESPACE_STD::invoke_result_t; }; // FIXME: The result for char(&())[2] is wrong on MSVC +template using TInvokeResult = NAMESPACE_STD::invoke_result_t; // FIXME: The result for char(&())[2] is wrong on MSVC template concept CRegularInvocable = CInvocable; template -concept CPredicate = CRegularInvocable && CBooleanTestable::Type>; +concept CPredicate = CRegularInvocable && CBooleanTestable>; template concept CRelation =