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

This commit is contained in:
_Redstone_c_ 2022-05-22 22:52:47 +08:00
parent 97910be70c
commit 2ce259e7cc
16 changed files with 233 additions and 236 deletions

View File

@ -270,7 +270,7 @@ void TestVariant()
{
using T = decltype(Arg);
always_check(Arg == 10);
always_check(CConst<typename TRemoveReference<T>::Type> == bIsConst);
always_check(CConst<TRemoveReference<T>> == bIsConst);
always_check(CLValueReference<T> == bIsLValue);
always_check(CRValueReference<T> == bIsRValue);
return 0;

View File

@ -322,108 +322,108 @@ void TestTypeTraits()
always_check(!(CConvertibleTo<FTestStructE*, FTestStructH*>));
always_check((CConvertibleTo<FTestStructW, FTestStructV>));
always_check((CSameAs<int32, TRemoveConst<int32>::Type>));
always_check(!(CSameAs<int32, TRemoveConst<int32*>::Type>));
always_check(!(CSameAs<int32, TRemoveConst<int32&>::Type>));
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((CSameAs<int32, TRemoveConst<int32>>));
always_check(!(CSameAs<int32, TRemoveConst<int32*>>));
always_check(!(CSameAs<int32, TRemoveConst<int32&>>));
always_check(!(CSameAs<int32, TRemoveConst<int32&&>>));
always_check((CSameAs<int32, TRemoveConst<const int32>>));
always_check(!(CSameAs<int32, TRemoveConst<volatile int32>>));
always_check(!(CSameAs<int32, TRemoveConst<const volatile int32>>));
always_check(!(CSameAs<int32, TRemoveConst<const volatile int32&>>));
always_check((CSameAs<int32, TRemoveVolatile<int32>::Type>));
always_check(!(CSameAs<int32, TRemoveVolatile<int32*>::Type>));
always_check(!(CSameAs<int32, TRemoveVolatile<int32&>::Type>));
always_check(!(CSameAs<int32, TRemoveVolatile<int32&&>::Type>));
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((CSameAs<int32, TRemoveVolatile<int32>>));
always_check(!(CSameAs<int32, TRemoveVolatile<int32*>>));
always_check(!(CSameAs<int32, TRemoveVolatile<int32&>>));
always_check(!(CSameAs<int32, TRemoveVolatile<int32&&>>));
always_check(!(CSameAs<int32, TRemoveVolatile<const int32>>));
always_check((CSameAs<int32, TRemoveVolatile<volatile int32>>));
always_check(!(CSameAs<int32, TRemoveVolatile<const volatile int32>>));
always_check(!(CSameAs<int32, TRemoveVolatile<const volatile int32&>>));
always_check((CSameAs<int32, TRemoveCV<int32>::Type>));
always_check(!(CSameAs<int32, TRemoveCV<int32*>::Type>));
always_check(!(CSameAs<int32, TRemoveCV<int32&>::Type>));
always_check(!(CSameAs<int32, TRemoveCV<int32&&>::Type>));
always_check((CSameAs<int32, TRemoveCV<const int32>::Type>));
always_check((CSameAs<int32, TRemoveCV<volatile int32>::Type>));
always_check((CSameAs<int32, TRemoveCV<const volatile int32>::Type>));
always_check(!(CSameAs<int32, TRemoveCV<const volatile int32&>::Type>));
always_check((CSameAs<int32, TRemoveCV<int32>>));
always_check(!(CSameAs<int32, TRemoveCV<int32*>>));
always_check(!(CSameAs<int32, TRemoveCV<int32&>>));
always_check(!(CSameAs<int32, TRemoveCV<int32&&>>));
always_check((CSameAs<int32, TRemoveCV<const int32>>));
always_check((CSameAs<int32, TRemoveCV<volatile int32>>));
always_check((CSameAs<int32, TRemoveCV<const volatile int32>>));
always_check(!(CSameAs<int32, TRemoveCV<const volatile int32&>>));
always_check((CSameAs<int32, TRemovePointer<int32>::Type>));
always_check((CSameAs<int32, TRemovePointer<int32*>::Type>));
always_check(!(CSameAs<int32, TRemovePointer<int32&>::Type>));
always_check(!(CSameAs<int32, TRemovePointer<int32&&>::Type>));
always_check(!(CSameAs<int32, TRemovePointer<const int32>::Type>));
always_check(!(CSameAs<int32, TRemovePointer<volatile int32>::Type>));
always_check(!(CSameAs<int32, TRemovePointer<const volatile int32>::Type>));
always_check(!(CSameAs<int32, TRemovePointer<const volatile int32&>::Type>));
always_check((CSameAs<int32, TRemovePointer<int32>>));
always_check((CSameAs<int32, TRemovePointer<int32*>>));
always_check(!(CSameAs<int32, TRemovePointer<int32&>>));
always_check(!(CSameAs<int32, TRemovePointer<int32&&>>));
always_check(!(CSameAs<int32, TRemovePointer<const int32>>));
always_check(!(CSameAs<int32, TRemovePointer<volatile int32>>));
always_check(!(CSameAs<int32, TRemovePointer<const volatile int32>>));
always_check(!(CSameAs<int32, TRemovePointer<const volatile int32&>>));
always_check((CSameAs<int32, TRemoveReference<int32>::Type>));
always_check(!(CSameAs<int32, TRemoveReference<int32*>::Type>));
always_check((CSameAs<int32, TRemoveReference<int32&>::Type>));
always_check((CSameAs<int32, TRemoveReference<int32&&>::Type>));
always_check(!(CSameAs<int32, TRemoveReference<const int32>::Type>));
always_check(!(CSameAs<int32, TRemoveReference<volatile int32>::Type>));
always_check(!(CSameAs<int32, TRemoveReference<const volatile int32>::Type>));
always_check(!(CSameAs<int32, TRemoveReference<const volatile int32&>::Type>));
always_check((CSameAs<int32, TRemoveReference<int32>>));
always_check(!(CSameAs<int32, TRemoveReference<int32*>>));
always_check((CSameAs<int32, TRemoveReference<int32&>>));
always_check((CSameAs<int32, TRemoveReference<int32&&>>));
always_check(!(CSameAs<int32, TRemoveReference<const int32>>));
always_check(!(CSameAs<int32, TRemoveReference<volatile int32>>));
always_check(!(CSameAs<int32, TRemoveReference<const volatile int32>>));
always_check(!(CSameAs<int32, TRemoveReference<const volatile int32&>>));
always_check((CSameAs<int32, TRemoveCVRef<int32>::Type>));
always_check(!(CSameAs<int32, TRemoveCVRef<int32*>::Type>));
always_check((CSameAs<int32, TRemoveCVRef<int32&>::Type>));
always_check((CSameAs<int32, TRemoveCVRef<int32&&>::Type>));
always_check((CSameAs<int32, TRemoveCVRef<const int32>::Type>));
always_check((CSameAs<int32, TRemoveCVRef<volatile int32>::Type>));
always_check((CSameAs<int32, TRemoveCVRef<const volatile int32>::Type>));
always_check((CSameAs<int32, TRemoveCVRef<const volatile int32&>::Type>));
always_check((CSameAs<int32, TRemoveCVRef<int32>>));
always_check(!(CSameAs<int32, TRemoveCVRef<int32*>>));
always_check((CSameAs<int32, TRemoveCVRef<int32&>>));
always_check((CSameAs<int32, TRemoveCVRef<int32&&>>));
always_check((CSameAs<int32, TRemoveCVRef<const int32>>));
always_check((CSameAs<int32, TRemoveCVRef<volatile int32>>));
always_check((CSameAs<int32, TRemoveCVRef<const volatile int32>>));
always_check((CSameAs<int32, TRemoveCVRef<const volatile int32&>>));
always_check((CSameAs<int32, TRemoveExtent<int32[1]>::Type>));
always_check(!(CSameAs<int32, TRemoveExtent<int32[1][2]>::Type>));
always_check((CSameAs<int32[2][3], TRemoveExtent<int32[1][2][3]>::Type>));
always_check((CSameAs<int32, TRemoveExtent<int32[1]>>));
always_check(!(CSameAs<int32, TRemoveExtent<int32[1][2]>>));
always_check((CSameAs<int32[2][3], TRemoveExtent<int32[1][2][3]>>));
always_check((CSameAs<int32, TRemoveAllExtents<int32[1]>::Type>));
always_check((CSameAs<int32, TRemoveAllExtents<int32[1][2]>::Type>));
always_check((CSameAs<int32, TRemoveAllExtents<int32[1][2][3]>::Type>));
always_check((CSameAs<int32, TRemoveAllExtents<int32[1]>>));
always_check((CSameAs<int32, TRemoveAllExtents<int32[1][2]>>));
always_check((CSameAs<int32, TRemoveAllExtents<int32[1][2][3]>>));
always_check((CSameAs<int32, TMakeSigned<int32>::Type>));
always_check((CSameAs<int32, TMakeSigned<uint32>::Type>));
always_check((CSameAs<int32, TMakeSigned<int32>>));
always_check((CSameAs<int32, TMakeSigned<uint32>>));
always_check((CSameAs<uint32, TMakeUnsigned<int32>::Type>));
always_check((CSameAs<uint32, TMakeUnsigned<uint32>::Type>));
always_check((CSameAs<uint32, TMakeUnsigned<int32>>));
always_check((CSameAs<uint32, TMakeUnsigned<uint32>>));
TAlignedStorage<32, 4>::Type Aligned4;
TAlignedStorage<32, 8>::Type Aligned8;
TAlignedStorage<32, 16>::Type Aligned16;
TAlignedStorage<32, 32>::Type Aligned32;
TAlignedStorage<32, 4> Aligned4;
TAlignedStorage<32, 8> Aligned8;
TAlignedStorage<32, 16> Aligned16;
TAlignedStorage<32, 32> Aligned32;
always_check((int64)(&Aligned4) % 4 == 0);
always_check((int64)(&Aligned8) % 8 == 0);
always_check((int64)(&Aligned16) % 16 == 0);
always_check((int64)(&Aligned32) % 32 == 0);
always_check(sizeof(TAlignedUnion<8, int32, int32>::Type) == 8);
always_check(sizeof(TAlignedUnion<0, int8, int32>::Type) == 4);
always_check(sizeof(TAlignedUnion<0, int32, int64>::Type) == 8);
always_check(sizeof(TAlignedUnion<0, int32, double>::Type) == 8);
always_check(sizeof(TAlignedUnion<8, int32, int32>) == 8);
always_check(sizeof(TAlignedUnion<0, int8, int32>) == 4);
always_check(sizeof(TAlignedUnion<0, int32, int64>) == 8);
always_check(sizeof(TAlignedUnion<0, int32, double>) == 8);
always_check((CSameAs<int32, TDecay<int32>::Type>));
always_check((CSameAs<int32*, TDecay<int32*>::Type>));
always_check((CSameAs<int32*, TDecay<int32[]>::Type>));
always_check((CSameAs<int32, TDecay<int32&>::Type>));
always_check((CSameAs<int32, TDecay<int32&&>::Type>));
always_check((CSameAs<int32, TDecay<const int32>::Type>));
always_check((CSameAs<int32, TDecay<volatile int32>::Type>));
always_check((CSameAs<int32, TDecay<const volatile int32>::Type>));
always_check((CSameAs<int32, TDecay<const volatile int32&>::Type>));
always_check((CSameAs<int32, TDecay<int32>>));
always_check((CSameAs<int32*, TDecay<int32*>>));
always_check((CSameAs<int32*, TDecay<int32[]>>));
always_check((CSameAs<int32, TDecay<int32&>>));
always_check((CSameAs<int32, TDecay<int32&&>>));
always_check((CSameAs<int32, TDecay<const int32>>));
always_check((CSameAs<int32, TDecay<volatile int32>>));
always_check((CSameAs<int32, TDecay<const volatile int32>>));
always_check((CSameAs<int32, TDecay<const volatile int32&>>));
always_check((CSameAs<int32, TConditional<true, int32, int64>::Type>));
always_check((CSameAs<int64, TConditional<false, int32, int64>::Type>));
always_check((CSameAs<int32, TConditional<true, int32, int64>>));
always_check((CSameAs<int64, TConditional<false, int32, int64>>));
always_check((CSameAs<int, TUnderlyingType<ETestEnumClass>::Type>));
always_check((CSameAs<uint8, TUnderlyingType<ETestEnumClass8>::Type>));
always_check((CSameAs<uint32, TUnderlyingType<ETestEnumClass32>::Type>));
always_check((CSameAs<uint64, TUnderlyingType<ETestEnumClass64>::Type>));
always_check((CSameAs<int, TUnderlyingType<ETestEnumClass>>));
always_check((CSameAs<uint8, TUnderlyingType<ETestEnumClass8>>));
always_check((CSameAs<uint32, TUnderlyingType<ETestEnumClass32>>));
always_check((CSameAs<uint64, TUnderlyingType<ETestEnumClass64>>));
always_check((CSameAs<void, TVoid<int32>::Type>));
always_check((CSameAs<void, TVoid<int32, int64>::Type>));
always_check((CSameAs<void, TVoid<int32>>));
always_check((CSameAs<void, TVoid<int32, int64>>));
// Invocable.h

View File

@ -42,9 +42,9 @@ concept CThreeWayComparesAs = CSameAs<typename TCommonComparisonCategory<T, Orde
template <typename T, typename U = T, typename OrderingType = partial_ordering>
concept CThreeWayComparable = CWeaklyEqualityComparable<T, U> && CPartiallyOrdered<T, U>
&& CCommonReference<const typename TRemoveReference<T>::Type&, const typename TRemoveReference<U>::Type&>
&& requires(const typename TRemoveReference<T>::Type& A, const typename TRemoveReference<U>::Type& B,
const typename TRemoveReference<typename TCommonReference<const typename TRemoveReference<T>::Type&, const typename TRemoveReference<U>::Type&>::Type>::Type& C)
&& CCommonReference<const TRemoveReference<T>&, const TRemoveReference<U>&>
&& requires(const TRemoveReference<T>& A, const TRemoveReference<U>& B,
const TRemoveReference<typename TCommonReference<const TRemoveReference<T>&, const TRemoveReference<U>&>::Type>& C)
{
{ A <=> A } -> CThreeWayComparesAs<OrderingType>;
{ B <=> B } -> CThreeWayComparesAs<OrderingType>;
@ -53,13 +53,10 @@ concept CThreeWayComparable = CWeaklyEqualityComparable<T, U> && CPartiallyOrder
{ C <=> C } -> CThreeWayComparesAs<OrderingType>;
};
template <typename T, typename U = T>
struct TCompareThreeWayResult { };
template <typename T, typename U> requires CThreeWayComparable<T, U>
struct TCompareThreeWayResult<T, U>
template <typename T, typename U = T> requires CThreeWayComparable<T, U>
struct TCompareThreeWayResult
{
using Type = decltype(DeclVal<const typename TRemoveReference<T>::Type&>() <=> DeclVal<const typename TRemoveReference<U>::Type&>());
using Type = decltype(DeclVal<const TRemoveReference<T>&>() <=> DeclVal<const TRemoveReference<U>&>());
};
template <typename T, typename U = T, typename OrderingType = partial_ordering>
@ -81,7 +78,7 @@ constexpr decltype(auto) SynthThreeWayCompare(T&& LHS, U&& RHS)
template <typename T, typename U = T>
struct TSynthThreeWayResult
{
using Type = decltype(SynthThreeWayCompare(DeclVal<const typename TRemoveReference<T>::Type&>(), DeclVal<const typename TRemoveReference<U>::Type&>()));
using Type = decltype(SynthThreeWayCompare(DeclVal<const TRemoveReference<T>&>(), DeclVal<const TRemoveReference<U>&>()));
};
NAMESPACE_MODULE_END(Utility)

View File

@ -68,17 +68,17 @@ struct alignas(InlineAlignment) TAny
}
}
template <typename T, typename... Types> requires CDestructible<typename TDecay<T>::Type>
&& CConstructibleFrom<typename TDecay<T>::Type, Types...>
template <typename T, typename... Types> requires CDestructible<TDecay<T>>
&& CConstructibleFrom<TDecay<T>, Types...>
FORCEINLINE explicit TAny(TInPlaceType<T>, Types&&... Args)
{
using SelectedType = typename TDecay<T>::Type;
using SelectedType = TDecay<T>;
EmplaceImpl<SelectedType>(Forward<Types>(Args)...);
}
template <typename T> requires (!CSameAs<typename TDecay<T>::Type, TAny>) && (!CTInPlaceType<typename TDecay<T>::Type>)
&& CDestructible<typename TDecay<T>::Type> && CConstructibleFrom<typename TDecay<T>::Type, T&&>
FORCEINLINE TAny(T&& InValue) : TAny(InPlaceType<typename TDecay<T>::Type>, Forward<T>(InValue))
template <typename T> requires (!CSameAs<TDecay<T>, TAny>) && (!CTInPlaceType<TDecay<T>>)
&& CDestructible<TDecay<T>> && CConstructibleFrom<TDecay<T>, T&&>
FORCEINLINE TAny(T&& InValue) : TAny(InPlaceType<TDecay<T>>, Forward<T>(InValue))
{ }
FORCEINLINE ~TAny()
@ -184,11 +184,11 @@ struct alignas(InlineAlignment) TAny
return *this;
}
template <typename T> requires (!CSameAs<typename TDecay<T>::Type, TAny>) && (!CTInPlaceType<typename TDecay<T>::Type>)
&& CDestructible<typename TDecay<T>::Type> && CConstructibleFrom<typename TDecay<T>::Type, T&&>
template <typename T> requires (!CSameAs<TDecay<T>, TAny>) && (!CTInPlaceType<TDecay<T>>)
&& CDestructible<TDecay<T>> && CConstructibleFrom<TDecay<T>, T&&>
FORCEINLINE TAny& operator=(T&& InValue)
{
using SelectedType = typename TDecay<T>::Type;
using SelectedType = TDecay<T>;
if (HoldsAlternative<SelectedType>())
{
@ -203,13 +203,13 @@ struct alignas(InlineAlignment) TAny
return *this;
}
template <typename T, typename... Types> requires CDestructible<typename TDecay<T>::Type>
&& CConstructibleFrom<typename TDecay<T>::Type, T&&>
FORCEINLINE typename TDecay<T>::Type& Emplace(Types&&... Args)
template <typename T, typename... Types> requires CDestructible<TDecay<T>>
&& CConstructibleFrom<TDecay<T>, T&&>
FORCEINLINE TDecay<T>& Emplace(Types&&... Args)
{
ResetImpl();
using SelectedType = typename TDecay<T>::Type;
using SelectedType = TDecay<T>;
EmplaceImpl<SelectedType>(Forward<Types>(Args)...);
return GetValue<SelectedType>();
}
@ -221,22 +221,22 @@ struct alignas(InlineAlignment) TAny
template <typename T> constexpr bool HoldsAlternative() const { return IsValid() ? GetTypeInfo() == typeid(T) : false; }
template <typename T> requires CDestructible<typename TDecay<T>::Type>
template <typename T> requires CDestructible<TDecay<T>>
constexpr T& GetValue() & { 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 *reinterpret_cast< T*>(GetAllocation()); }
template <typename T> requires CDestructible<typename TDecay<T>::Type>
template <typename T> requires CDestructible<TDecay<T>>
constexpr T&& GetValue() && { 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< T*>(GetAllocation())); }
template <typename T> requires CDestructible<typename TDecay<T>::Type>
template <typename T> requires CDestructible<TDecay<T>>
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 *reinterpret_cast<const T*>(GetAllocation()); }
template <typename T> requires CDestructible<typename TDecay<T>::Type>
template <typename T> requires CDestructible<TDecay<T>>
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 CSameAs<T, typename TDecay<T>::Type>&& CDestructible<typename TDecay<T>::Type>
template <typename T> requires CSameAs<T, TDecay<T>>&& CDestructible<TDecay<T>>
constexpr T& Get( T& DefaultValue) & { return HoldsAlternative<T>() ? GetValue<T>() : DefaultValue; }
template <typename T> requires CSameAs<T, typename TDecay<T>::Type>&& CDestructible<typename TDecay<T>::Type>
template <typename T> requires CSameAs<T, TDecay<T>>&& CDestructible<TDecay<T>>
constexpr const T& Get(const T& DefaultValue) const& { return HoldsAlternative<T>() ? GetValue<T>() : DefaultValue; }
FORCEINLINE void Reset()
@ -345,7 +345,7 @@ private:
union
{
TAlignedStorage<InlineSize, 1>::Type InlineAllocation;
TAlignedStorage<InlineSize, 1> InlineAllocation;
void* HeapAllocation;
};

View File

@ -15,12 +15,12 @@ NAMESPACE_MODULE_BEGIN(Utility)
enum class EMemoryOrder : uint8
{
Relaxed = static_cast<typename TUnderlyingType<NAMESPACE_STD::memory_order>::Type>(NAMESPACE_STD::memory_order_relaxed),
Consume = static_cast<typename TUnderlyingType<NAMESPACE_STD::memory_order>::Type>(NAMESPACE_STD::memory_order_consume),
Acquire = static_cast<typename TUnderlyingType<NAMESPACE_STD::memory_order>::Type>(NAMESPACE_STD::memory_order_acquire),
Release = static_cast<typename TUnderlyingType<NAMESPACE_STD::memory_order>::Type>(NAMESPACE_STD::memory_order_release),
AcquireRelease = static_cast<typename TUnderlyingType<NAMESPACE_STD::memory_order>::Type>(NAMESPACE_STD::memory_order_acq_rel),
SequentiallyConsistent = static_cast<typename TUnderlyingType<NAMESPACE_STD::memory_order>::Type>(NAMESPACE_STD::memory_order_seq_cst),
Relaxed = static_cast<TUnderlyingType<NAMESPACE_STD::memory_order>>(NAMESPACE_STD::memory_order_relaxed),
Consume = static_cast<TUnderlyingType<NAMESPACE_STD::memory_order>>(NAMESPACE_STD::memory_order_consume),
Acquire = static_cast<TUnderlyingType<NAMESPACE_STD::memory_order>>(NAMESPACE_STD::memory_order_acquire),
Release = static_cast<TUnderlyingType<NAMESPACE_STD::memory_order>>(NAMESPACE_STD::memory_order_release),
AcquireRelease = static_cast<TUnderlyingType<NAMESPACE_STD::memory_order>>(NAMESPACE_STD::memory_order_acq_rel),
SequentiallyConsistent = static_cast<TUnderlyingType<NAMESPACE_STD::memory_order>>(NAMESPACE_STD::memory_order_seq_cst),
};
#if BUILD_DEBUG
@ -58,7 +58,7 @@ struct TAtomic : public FSingleton
{
protected:
using ElementType = typename TConditional<bIsRef, NAMESPACE_STD::atomic_ref<T>, NAMESPACE_STD::atomic<T>>::Type;
using ElementType = TConditional<bIsRef, NAMESPACE_STD::atomic_ref<T>, NAMESPACE_STD::atomic<T>>;
public:

View File

@ -115,10 +115,10 @@ public:
FORCEINLINE const type_info& TargetType() const requires (!bIsRef) { return IsValid() ? Storage.GetTypeInfo() : typeid(void); };
template <typename T> FORCEINLINE T& Target() & requires (!bIsRef) && CDestructible<typename TDecay<T>::Type> { return static_cast< StorageType& >(Storage).template GetValue<T>(); }
template <typename T> FORCEINLINE T&& Target() && requires (!bIsRef) && CDestructible<typename TDecay<T>::Type> { return static_cast< StorageType&&>(Storage).template GetValue<T>(); }
template <typename T> FORCEINLINE const T& Target() const& requires (!bIsRef) && CDestructible<typename TDecay<T>::Type> { return static_cast<const StorageType& >(Storage).template GetValue<T>(); }
template <typename T> FORCEINLINE const T&& Target() const&& requires (!bIsRef) && CDestructible<typename TDecay<T>::Type> { return static_cast<const StorageType&&>(Storage).template GetValue<T>(); }
template <typename T> FORCEINLINE T& Target() & requires (!bIsRef) && CDestructible<TDecay<T>> { return static_cast< StorageType& >(Storage).template GetValue<T>(); }
template <typename T> FORCEINLINE T&& Target() && requires (!bIsRef) && CDestructible<TDecay<T>> { return static_cast< StorageType&&>(Storage).template GetValue<T>(); }
template <typename T> FORCEINLINE const T& Target() const& requires (!bIsRef) && CDestructible<TDecay<T>> { return static_cast<const StorageType& >(Storage).template GetValue<T>(); }
template <typename T> FORCEINLINE const T&& Target() const&& requires (!bIsRef) && CDestructible<TDecay<T>> { return static_cast<const StorageType&&>(Storage).template GetValue<T>(); }
constexpr void Swap(TFunctionImpl& InValue) requires (!bIsRef)
{
@ -146,8 +146,8 @@ public:
private:
using StorageType = typename TConditional<bIsRef, typename TCopyConst<CVRef, void>::Type*, TAny<InlineSize, 1>>::Type;
using StorageRef = typename TConditional<bIsRef, typename TCopyConst<CVRef, void>::Type*, typename TCopyCVRef<CVRef, StorageType>::Type&>::Type;
using StorageType = TConditional<bIsRef, typename TCopyConst<CVRef, void>::Type*, TAny<InlineSize, 1>>;
using StorageRef = TConditional<bIsRef, typename TCopyConst<CVRef, void>::Type*, typename TCopyCVRef<CVRef, StorageType>::Type&>;
using CallFunc = ResultType(*)(StorageRef, Types&&...);
@ -171,18 +171,18 @@ protected:
template <typename DecayedType, typename... ArgTypes>
FORCEINLINE void EmplaceImpl(ArgTypes&&... Args)
{
using CallableType = typename TCopyConst<typename TRemoveReference<CVRef>::Type, DecayedType>::Type;
using CallableType = typename TCopyConst<TRemoveReference<CVRef>, DecayedType>::Type;
if constexpr (bIsRef) Storage = ((reinterpret_cast<StorageType>(AddressOf(Args))), ...);
else Storage.template Emplace<DecayedType>(Forward<ArgTypes>(Args)...);
Callable = [](StorageRef Storage, Types&&... Args) -> ResultType
{
using InvokeType = typename TConditional<
using InvokeType = TConditional<
CReference<CVRef>,
typename TCopyCVRef<CVRef, CallableType>::Type,
typename TCopyCVRef<CVRef, CallableType>::Type&
>::Type;
>;
const auto GetFunc = [&Storage]() -> InvokeType
{
@ -249,11 +249,11 @@ public:
TFunctionRef& operator=(const TFunctionRef& InValue) = delete;
TFunctionRef& operator=(TFunctionRef&& InValue) = delete;
template <typename T> requires (!CTFunctionRef<typename TDecay<T>::Type>) && (!CTInPlaceType<typename TDecay<T>::Type>)
&& NAMESPACE_PRIVATE::TIsInvocableSignature<F, typename TDecay<T>::Type>::Value
template <typename T> requires (!CTFunctionRef<TDecay<T>>) && (!CTInPlaceType<TDecay<T>>)
&& NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value
FORCEINLINE TFunctionRef(T&& InValue)
{
using DecayedType = typename TDecay<T>::Type;
using DecayedType = TDecay<T>;
checkf(NAMESPACE_PRIVATE::FunctionIsBound(InValue), TEXT("Cannot bind a null/unbound callable to a TFunctionRef"));
Super::template EmplaceImpl<DecayedType>(Forward<T>(InValue));
}
@ -302,33 +302,33 @@ public:
return *this;
}
template <typename T> requires (!CTInPlaceType<typename TDecay<T>::Type>)
&& (!CTFunctionRef<typename TDecay<T>::Type>) && (!CTFunction<typename TDecay<T>::Type>) && (!CTUniqueFunction<typename TDecay<T>::Type>)
&& CConstructibleFrom<typename TDecay<T>::Type, T&&> && CCopyConstructible<typename TDecay<T>::Type>
&& NAMESPACE_PRIVATE::TIsInvocableSignature<F, typename TDecay<T>::Type>::Value
template <typename T> requires (!CTInPlaceType<TDecay<T>>)
&& (!CTFunctionRef<TDecay<T>>) && (!CTFunction<TDecay<T>>) && (!CTUniqueFunction<TDecay<T>>)
&& CConstructibleFrom<TDecay<T>, T&&> && CCopyConstructible<TDecay<T>>
&& NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value
FORCEINLINE TFunction(T&& InValue)
{
using DecayedType = typename TDecay<T>::Type;
using DecayedType = TDecay<T>;
if (!NAMESPACE_PRIVATE::FunctionIsBound(InValue)) Super::ResetImpl();
else Super::template EmplaceImpl<DecayedType>(Forward<T>(InValue));
}
template <typename T, typename... ArgTypes> requires NAMESPACE_PRIVATE::TIsInvocableSignature<F, typename TDecay<T>::Type>::Value
&& CConstructibleFrom<typename TDecay<T>::Type, ArgTypes...> && CCopyConstructible<typename TDecay<T>::Type>
template <typename T, typename... ArgTypes> requires NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value
&& CConstructibleFrom<TDecay<T>, ArgTypes...> && CCopyConstructible<TDecay<T>>
FORCEINLINE TFunction(TInPlaceType<T>, ArgTypes&&... Args)
{
using DecayedType = typename TDecay<T>::Type;
using DecayedType = TDecay<T>;
Super::template EmplaceImpl<DecayedType>(Forward<ArgTypes>(Args)...);
}
constexpr TFunction& operator=(nullptr_t) { Super::ResetImpl(); return *this; }
template <typename T> requires NAMESPACE_PRIVATE::TIsInvocableSignature<F, typename TDecay<T>::Type>::Value
&& (!CTFunctionRef<typename TDecay<T>::Type>) && (!CTFunction<typename TDecay<T>::Type>) && (!CTUniqueFunction<typename TDecay<T>::Type>)
&& CConstructibleFrom<typename TDecay<T>::Type, T&&> && CCopyConstructible<typename TDecay<T>::Type>
template <typename T> requires NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value
&& (!CTFunctionRef<TDecay<T>>) && (!CTFunction<TDecay<T>>) && (!CTUniqueFunction<TDecay<T>>)
&& CConstructibleFrom<TDecay<T>, T&&> && CCopyConstructible<TDecay<T>>
FORCEINLINE TFunction& operator=(T&& InValue)
{
using DecayedType = typename TDecay<T>::Type;
using DecayedType = TDecay<T>;
if (!NAMESPACE_PRIVATE::FunctionIsBound(InValue)) Super::ResetImpl();
else Super::template EmplaceImpl<DecayedType>(Forward<T>(InValue));
@ -336,11 +336,11 @@ public:
return *this;
}
template <typename T, typename... ArgTypes> requires NAMESPACE_PRIVATE::TIsInvocableSignature<F, typename TDecay<T>::Type>::Value
&& CConstructibleFrom<typename TDecay<T>::Type, ArgTypes...>&& CCopyConstructible<typename TDecay<T>::Type>
FORCEINLINE typename TDecay<T>::Type& Emplace(ArgTypes&&... Args)
template <typename T, typename... ArgTypes> requires NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value
&& CConstructibleFrom<TDecay<T>, ArgTypes...>&& CCopyConstructible<TDecay<T>>
FORCEINLINE TDecay<T>& Emplace(ArgTypes&&... Args)
{
using DecayedType = typename TDecay<T>::Type;
using DecayedType = TDecay<T>;
Super::template EmplaceImpl<DecayedType>(Forward<ArgTypes>(Args)...);
return Super::template Target<DecayedType>();
}
@ -405,33 +405,33 @@ public:
return *this;
}
template <typename T> requires (!CTInPlaceType<typename TDecay<T>::Type>)
&& (!CTFunctionRef<typename TDecay<T>::Type>) && (!CTFunction<typename TDecay<T>::Type>) && (!CTUniqueFunction<typename TDecay<T>::Type>)
&& CConstructibleFrom<typename TDecay<T>::Type, T&&> && CMoveConstructible<typename TDecay<T>::Type>
&& NAMESPACE_PRIVATE::TIsInvocableSignature<F, typename TDecay<T>::Type>::Value
template <typename T> requires (!CTInPlaceType<TDecay<T>>)
&& (!CTFunctionRef<TDecay<T>>) && (!CTFunction<TDecay<T>>) && (!CTUniqueFunction<TDecay<T>>)
&& CConstructibleFrom<TDecay<T>, T&&> && CMoveConstructible<TDecay<T>>
&& NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value
FORCEINLINE TUniqueFunction(T&& InValue)
{
using DecayedType = typename TDecay<T>::Type;
using DecayedType = TDecay<T>;
if (!NAMESPACE_PRIVATE::FunctionIsBound(InValue)) Super::ResetImpl();
else Super::template EmplaceImpl<DecayedType>(Forward<T>(InValue));
}
template <typename T, typename... ArgTypes> requires NAMESPACE_PRIVATE::TIsInvocableSignature<F, typename TDecay<T>::Type>::Value
&& CConstructibleFrom<typename TDecay<T>::Type, ArgTypes...> && CMoveConstructible<typename TDecay<T>::Type>
template <typename T, typename... ArgTypes> requires NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value
&& CConstructibleFrom<TDecay<T>, ArgTypes...> && CMoveConstructible<TDecay<T>>
FORCEINLINE TUniqueFunction(TInPlaceType<T>, ArgTypes&&... Args)
{
using DecayedType = typename TDecay<T>::Type;
using DecayedType = TDecay<T>;
Super::template EmplaceImpl<DecayedType>(Forward<ArgTypes>(Args)...);
}
constexpr TUniqueFunction& operator=(nullptr_t) { Super::ResetImpl(); return *this; }
template <typename T> requires NAMESPACE_PRIVATE::TIsInvocableSignature<F, typename TDecay<T>::Type>::Value
&& (!CTFunctionRef<typename TDecay<T>::Type>) && (!CTFunction<typename TDecay<T>::Type>) && (!CTUniqueFunction<typename TDecay<T>::Type>)
&& CConstructibleFrom<typename TDecay<T>::Type, T&&>&& CMoveConstructible<typename TDecay<T>::Type>
template <typename T> requires NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value
&& (!CTFunctionRef<TDecay<T>>) && (!CTFunction<TDecay<T>>) && (!CTUniqueFunction<TDecay<T>>)
&& CConstructibleFrom<TDecay<T>, T&&>&& CMoveConstructible<TDecay<T>>
FORCEINLINE TUniqueFunction& operator=(T&& InValue)
{
using DecayedType = typename TDecay<T>::Type;
using DecayedType = TDecay<T>;
if (!NAMESPACE_PRIVATE::FunctionIsBound(InValue)) Super::ResetImpl();
else Super::template EmplaceImpl<DecayedType>(Forward<T>(InValue));
@ -439,11 +439,11 @@ public:
return *this;
}
template <typename T, typename... ArgTypes> requires NAMESPACE_PRIVATE::TIsInvocableSignature<F, typename TDecay<T>::Type>::Value
&& CConstructibleFrom<typename TDecay<T>::Type, ArgTypes...>&& CMoveConstructible<typename TDecay<T>::Type>
FORCEINLINE typename TDecay<T>::Type& Emplace(ArgTypes&&... Args)
template <typename T, typename... ArgTypes> requires NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value
&& CConstructibleFrom<TDecay<T>, ArgTypes...>&& CMoveConstructible<TDecay<T>>
FORCEINLINE TDecay<T>& Emplace(ArgTypes&&... Args)
{
using DecayedType = typename TDecay<T>::Type;
using DecayedType = TDecay<T>;
Super::template EmplaceImpl<DecayedType>(Forward<ArgTypes>(Args)...);
return Super::template Target<DecayedType>();
}
@ -518,9 +518,9 @@ struct TNotFunction
NAMESPACE_PRIVATE_END
template <typename F>
constexpr NAMESPACE_PRIVATE::TNotFunction<typename TDecay<F>::Type> NotFn(F&& Func)
constexpr NAMESPACE_PRIVATE::TNotFunction<TDecay<F>> NotFn(F&& Func)
{
return NAMESPACE_PRIVATE::TNotFunction<typename TDecay<F>::Type>(Forward<F>(Func));
return NAMESPACE_PRIVATE::TNotFunction<TDecay<F>>(Forward<F>(Func));
}
NAMESPACE_MODULE_END(Utility)

View File

@ -56,7 +56,7 @@ struct InvokeMemberObject
template <typename F,
typename T,
typename Decayed = typename TDecay<F>::Type,
typename Decayed = TDecay<F>,
bool IsMemberFunction = CMemberFunctionPointer<Decayed>,
bool IsMemberObject = CMemberObjectPointer<Decayed>>
struct InvokeMember;

View File

@ -48,7 +48,7 @@ public:
}
template <typename T = OptionalType> requires CConstructibleFrom<OptionalType, T&&>
&& (!CSameAs<typename TRemoveCVRef<T>::Type, FInPlace>) && (!CSameAs<typename TRemoveCVRef<T>::Type, TOptional>)
&& (!CSameAs<TRemoveCVRef<T>, FInPlace>) && (!CSameAs<TRemoveCVRef<T>, TOptional>)
constexpr explicit (!CConvertibleTo<T&&, OptionalType>) TOptional(T&& InValue)
: TOptional(InPlace, Forward<T>(InValue))
{ }
@ -246,7 +246,7 @@ public:
private:
TAlignedStorage<sizeof(OptionalType), alignof(OptionalType)>::Type Value;
TAlignedStorage<sizeof(OptionalType), alignof(OptionalType)> Value;
bool bIsValid;
};
@ -283,9 +283,9 @@ constexpr bool operator==(const TOptional<T>& LHS, FInvalid)
}
template <typename T> requires CDestructible<T>
constexpr TOptional<typename TDecay<T>::Type> MakeOptional(FInvalid)
constexpr TOptional<TDecay<T>> MakeOptional(FInvalid)
{
return TOptional<typename TDecay<T>::Type>(Invalid);
return TOptional<TDecay<T>>(Invalid);
}
template <typename T> requires CDestructible<T> && CConstructibleFrom<T, T&&>

View File

@ -111,7 +111,7 @@ template <typename T> concept CTReferenceWrapper = NAMESPACE_PRIVATE::TIsTRefere
template <typename T> struct TUnwrapReference { using Type = T; };
template <typename T> struct TUnwrapReference<TReferenceWrapper<T>> { using Type = T&; };
template <typename T> struct TUnwrapRefDecay { using Type = typename TUnwrapReference<typename TDecay<T>::Type>::Type; };
template <typename T> struct TUnwrapRefDecay { using Type = typename TUnwrapReference<TDecay<T>>::Type; };
template <typename ReferencedType>
struct TOptional<TReferenceWrapper<ReferencedType>>
@ -150,7 +150,7 @@ public:
{ }
template <typename T = OptionalType> requires CConstructibleFrom<OptionalType, T&&>
&& (!CSameAs<typename TRemoveCVRef<T>::Type, FInPlace>) && (!CSameAs<typename TRemoveCVRef<T>::Type, TOptional>)
&& (!CSameAs<TRemoveCVRef<T>, FInPlace>) && (!CSameAs<TRemoveCVRef<T>, TOptional>)
constexpr explicit (!CConvertibleTo<T&&, OptionalType>) TOptional(T&& InValue)
: TOptional(InPlace, Forward<T>(InValue))
{ }

View File

@ -401,13 +401,13 @@ NAMESPACE_PRIVATE_END
template <typename T> concept CTTuple = NAMESPACE_PRIVATE::TIsTTuple<T>::Value;
template <typename TupleType> requires CTTuple<typename TRemoveCVRef<TupleType>::Type>
struct TTupleElementSize : TConstant<size_t, TRemoveCVRef<TupleType>::Type::ElementSize> { };
template <typename TupleType> requires CTTuple<TRemoveCVRef<TupleType>>
struct TTupleElementSize : TConstant<size_t, TRemoveCVRef<TupleType>::ElementSize> { };
template <size_t I, typename TupleType> requires CTTuple<typename TRemoveCVRef<TupleType>::Type>
struct TTupleElementType { using Type = typename TCopyCVRef<typename TRemoveReference<TupleType>::Type, typename TRemoveCVRef<TupleType>::Type::template TElementType<I>::Type>::Type; };
template <size_t I, typename TupleType> requires CTTuple<TRemoveCVRef<TupleType>>
struct TTupleElementType { using Type = typename TCopyCVRef<TRemoveReference<TupleType>, typename TRemoveCVRef<TupleType>::template TElementType<I>::Type>::Type; };
template <typename T, typename TupleType> requires CTTuple<typename TRemoveCVRef<TupleType>::Type>
template <typename T, typename TupleType> requires CTTuple<TRemoveCVRef<TupleType>>
struct TTupleElementIndex : TupleType::template TElementIndex<T> { };
template <typename... Types>
@ -454,7 +454,7 @@ template <typename... RTypes, size_t... Indices>
struct TTupleCatMake<TTuple<RTypes...>, TIndexSequence<Indices...>>
{
template <typename T, typename U>
struct ForwardType { using Type = typename TConditional<CRValueReference<T>, typename TRemoveReference<U>::Type&&, U>::Type; };
struct ForwardType { using Type = TConditional<CRValueReference<T>, TRemoveReference<U>&&, U>; };
template <typename TTupleType>
static constexpr TTuple<RTypes...> F(TTupleType&& InValue)
@ -546,10 +546,10 @@ struct TTupleVisitImpl<TIndexSequence<>>
NAMESPACE_PRIVATE_END
template <typename... TTupleTypes> requires (true && ... && (CTTuple<typename TRemoveCVRef<TTupleTypes>::Type>))
struct TTupleCatResult { using Type = typename NAMESPACE_PRIVATE::TTupleCatResultImpl<typename TRemoveReference<TTupleTypes>::Type..., NAMESPACE_PRIVATE::FTupleEndFlag>::Type; };
template <typename... TTupleTypes> requires (true && ... && (CTTuple<TRemoveCVRef<TTupleTypes>>))
struct TTupleCatResult { using Type = typename NAMESPACE_PRIVATE::TTupleCatResultImpl<TRemoveReference<TTupleTypes>..., NAMESPACE_PRIVATE::FTupleEndFlag>::Type; };
template <typename... TTupleTypes> requires (true && ... && (CTTuple<typename TRemoveCVRef<TTupleTypes>::Type>))
template <typename... TTupleTypes> requires (true && ... && (CTTuple<TRemoveCVRef<TTupleTypes>>))
constexpr auto TupleCat(TTupleTypes&&... Args)
{
using R = typename TTupleCatResult<TTupleTypes...>::Type;

View File

@ -77,7 +77,7 @@ constexpr size_t GetTypeHash(T A)
template <typename T> requires CEnum<T>
constexpr size_t GetTypeHash(T A)
{
return GetTypeHash(static_cast<typename TUnderlyingType<T>::Type>(A));
return GetTypeHash(static_cast<TUnderlyingType<T>>(A));
}
template <typename T> requires CPointer<T> || CSameAs<T, nullptr_t>

View File

@ -25,9 +25,9 @@ constexpr const T(&AsConst(T(&Array)[N]))[N]
}
template <typename T>
constexpr typename TRemoveReference<T>::Type&& MoveTemp(T&& Obj)
constexpr TRemoveReference<T>&& MoveTemp(T&& Obj)
{
typedef typename TRemoveReference<T>::Type CastType;
typedef TRemoveReference<T> CastType;
return (CastType&&)Obj;
}
@ -50,13 +50,13 @@ constexpr T&& CopyTemp(T&& Val)
}
template <typename T>
constexpr T&& Forward(typename TRemoveReference<T>::Type& Obj)
constexpr T&& Forward(TRemoveReference<T>& Obj)
{
return (T&&)Obj;
}
template <typename T>
constexpr T&& Forward(typename TRemoveReference<T>::Type&& Obj)
constexpr T&& Forward(TRemoveReference<T>&& Obj)
{
return (T&&)Obj;
}

View File

@ -49,21 +49,21 @@ struct TVariantSelectedType;
template <typename T, typename U, typename... Types>
struct TVariantSelectedType<T, U, Types...>
{
using TypeAlternativeA = typename TConditional<CConstructibleFrom<U, T&&>, U, void>::Type;
using TypeAlternativeA = TConditional<CConstructibleFrom<U, T&&>, U, void>;
using TypeAlternativeB = typename TVariantSelectedType<T, Types...>::Type;
using Type = typename TConditional<CSameAs<typename TRemoveCVRef<TypeAlternativeA>::Type, void>, TypeAlternativeB,
typename TConditional<CSameAs<typename TRemoveCVRef<TypeAlternativeB>::Type, void>, TypeAlternativeA,
typename TConditional<CSameAs<typename TRemoveCVRef<TypeAlternativeB>::Type, typename TRemoveCVRef<T>::Type>, TypeAlternativeB, TypeAlternativeA>::Type>::Type>::Type;
using Type = TConditional<CSameAs<TRemoveCVRef<TypeAlternativeA>, void>, TypeAlternativeB,
TConditional<CSameAs<TRemoveCVRef<TypeAlternativeB>, void>, TypeAlternativeA,
TConditional<CSameAs<TRemoveCVRef<TypeAlternativeB>, TRemoveCVRef<T>>, TypeAlternativeB, TypeAlternativeA>>>;
// 0 - Type not found
// 1 - Same type found
// 2 - Multiple types found
// 3 - The type found
static constexpr uint8 Flag = CSameAs<typename TRemoveCVRef<Type>::Type, void> ? 0 :
CSameAs<typename TRemoveCVRef<TypeAlternativeA>::Type, typename TRemoveCVRef<TypeAlternativeB>::Type> ? 2 :
CSameAs<typename TRemoveCVRef< Type>::Type, typename TRemoveCVRef< T>::Type> ? 1 :
!CSameAs<typename TRemoveCVRef<TypeAlternativeA>::Type, void> && !CSameAs<TypeAlternativeB, void> ? 2 : 3;
static constexpr uint8 Flag = CSameAs<TRemoveCVRef<Type>, void> ? 0 :
CSameAs<TRemoveCVRef<TypeAlternativeA>, TRemoveCVRef<TypeAlternativeB>> ? 2 :
CSameAs<TRemoveCVRef< Type>, TRemoveCVRef< T>> ? 1 :
!CSameAs<TRemoveCVRef<TypeAlternativeA>, void> && !CSameAs<TypeAlternativeB, void> ? 2 : 3;
static constexpr bool Value = Flag & 1;
@ -117,10 +117,10 @@ struct TVariant
: TVariant(InPlaceIndex<TAlternativeIndex<T>::Value>, Forward<ArgTypes>(Args)...)
{ }
template <typename T> requires NAMESPACE_PRIVATE::TVariantSelectedType<typename TRemoveReference<T>::Type, Types...>::Value
&& (!CTInPlaceType<typename TRemoveCVRef<T>::Type>) && (!CTInPlaceIndex<typename TRemoveCVRef<T>::Type>)
&& (!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))
template <typename T> requires NAMESPACE_PRIVATE::TVariantSelectedType<TRemoveReference<T>, Types...>::Value
&& (!CTInPlaceType<TRemoveCVRef<T>>) && (!CTInPlaceIndex<TRemoveCVRef<T>>)
&& (!CSameAs<TRemoveCVRef<T>, TVariant>)
constexpr TVariant(T&& InValue) : TVariant(InPlaceType<typename NAMESPACE_PRIVATE::TVariantSelectedType<TRemoveReference<T>, Types...>::Type>, Forward<T>(InValue))
{ }
constexpr ~TVariant()
@ -170,10 +170,10 @@ struct TVariant
return *this;
}
template <typename T> requires NAMESPACE_PRIVATE::TVariantSelectedType<typename TRemoveReference<T>::Type, Types...>::Value
template <typename T> requires NAMESPACE_PRIVATE::TVariantSelectedType<TRemoveReference<T>, Types...>::Value
constexpr TVariant& operator=(T&& InValue)
{
using SelectedType = typename NAMESPACE_PRIVATE::TVariantSelectedType<typename TRemoveReference<T>::Type, Types...>::Type;
using SelectedType = typename NAMESPACE_PRIVATE::TVariantSelectedType<TRemoveReference<T>, Types...>::Type;
if (GetIndex() == TAlternativeIndex<SelectedType>::Value) GetValue<SelectedType>() = Forward<T>(InValue);
else
@ -370,7 +370,7 @@ private:
static constexpr FMoveAssignImpl MoveAssignImpl[] = { [](void* A, void* B) { if constexpr (requires(Types* A, Types* B) { Memory::MoveAssign (A, B); }) Memory::MoveAssign (reinterpret_cast<Types*>(A), reinterpret_cast< Types*>(B)); else checkf(false, TEXT("The type '%s' is not move assignable."), typeid(Types).name()); }... };
static constexpr FDestroyImpl DestroyImpl[] = { [](void* A ) { if constexpr (requires(Types* A ) { Memory::Destruct (A ); }) Memory::Destruct (reinterpret_cast<Types*>(A) ); else checkf(false, TEXT("The type '%s' is not destructible."), typeid(Types).name()); }... };
TAlignedUnion<1, Types...>::Type Value;
TAlignedUnion<1, Types...> Value;
uint8 TypeIndex;
friend constexpr bool operator==(const TVariant& LHS, const TVariant& RHS) requires (true && ... && CEqualityComparable<Types>)
@ -418,13 +418,13 @@ NAMESPACE_PRIVATE_END
template <typename T> concept CTVariant = NAMESPACE_PRIVATE::TIsTVariant<T>::Value;
template <typename VariantType> requires CTVariant<typename TRemoveCVRef<VariantType>::Type>
template <typename VariantType> requires CTVariant<TRemoveCVRef<VariantType>>
struct TVariantAlternativeSize : TConstant<size_t, VariantType::AlternativeSize> { };
template <size_t I, typename VariantType> requires CTVariant<typename TRemoveCVRef<VariantType>::Type>
struct TVariantAlternativeType { using Type = typename TCopyCV<typename TRemoveReference<VariantType>::Type, typename TRemoveCVRef<VariantType>::Type::template TAlternativeType<I>::Type>::Type; };
template <size_t I, typename VariantType> requires CTVariant<TRemoveCVRef<VariantType>>
struct TVariantAlternativeType { using Type = typename TCopyCV<TRemoveReference<VariantType>, typename TRemoveCVRef<VariantType>::template TAlternativeType<I>::Type>::Type; };
template <typename T, typename VariantType> requires CTVariant<typename TRemoveCVRef<VariantType>::Type>
template <typename T, typename VariantType> requires CTVariant<TRemoveCVRef<VariantType>>
struct TVariantAlternativeIndex : VariantType::template TAlternativeIndex<T> { };
NAMESPACE_MODULE_END(Utility)

View File

@ -21,8 +21,8 @@ template <typename... Types> struct TCommonReference { using Type = NAMESPACE_ST
NAMESPACE_PRIVATE_END
template <typename... Types> struct TCommonType : TConditional<NAMESPACE_PRIVATE::CCommonType<Types...>, NAMESPACE_PRIVATE::TCommonType<Types...>, NAMESPACE_PRIVATE::FNoopStruct>::Type { };
template <typename... Types> struct TCommonReference : TConditional<NAMESPACE_PRIVATE::CCommonReference<Types...>, NAMESPACE_PRIVATE::TCommonReference<Types...>, NAMESPACE_PRIVATE::FNoopStruct>::Type { };
template <typename... Types> struct TCommonType : TConditional<NAMESPACE_PRIVATE::CCommonType<Types...>, NAMESPACE_PRIVATE::TCommonType<Types...>, NAMESPACE_PRIVATE::FNoopStruct> { };
template <typename... Types> struct TCommonReference : TConditional<NAMESPACE_PRIVATE::CCommonReference<Types...>, NAMESPACE_PRIVATE::TCommonReference<Types...>, NAMESPACE_PRIVATE::FNoopStruct> { };
template <typename... Ts>
concept CCommonReference =

View File

@ -11,7 +11,7 @@ NAMESPACE_MODULE_BEGIN(Utility)
template <typename T, typename U = T>
concept CWeaklyEqualityComparable =
requires(const typename TRemoveReference<T>::Type& A, const typename TRemoveReference<U>::Type& B)
requires(const TRemoveReference<T>& A, const TRemoveReference<U>& B)
{
{ A == B } -> CBooleanTestable;
{ A != B } -> CBooleanTestable;
@ -21,12 +21,12 @@ concept CWeaklyEqualityComparable =
template <typename T, typename U = T>
concept CEqualityComparable = CWeaklyEqualityComparable<T> && CWeaklyEqualityComparable<U> && CWeaklyEqualityComparable<T, U>
&& CCommonReference<const typename TRemoveReference<T>::Type&, const typename TRemoveReference<U>::Type&>
&& CWeaklyEqualityComparable<typename TCommonReference<const typename TRemoveReference<T>::Type&, const typename TRemoveReference<U>::Type&>::Type>;
&& CCommonReference<const TRemoveReference<T>&, const TRemoveReference<U>&>
&& CWeaklyEqualityComparable<typename TCommonReference<const TRemoveReference<T>&, const TRemoveReference<U>&>::Type>;
template <typename T, typename U = T>
concept CPartiallyOrdered =
requires(const typename TRemoveReference<T>::Type& A, const typename TRemoveReference<U>::Type& B)
requires(const TRemoveReference<T>& A, const TRemoveReference<U>& B)
{
{ A < B } -> CBooleanTestable;
{ A > B } -> CBooleanTestable;
@ -43,8 +43,8 @@ concept CTotallyOrdered =
CPartiallyOrdered<T> && CPartiallyOrdered<U>
&& CEqualityComparable<T> && CEqualityComparable<U>
&& CPartiallyOrdered<T, U> && CEqualityComparable<T, U>
&& CPartiallyOrdered<typename TCommonReference<const typename TRemoveReference<T>::Type&, const typename TRemoveReference<U>::Type&>::Type>
&& CEqualityComparable<typename TCommonReference<const typename TRemoveReference<T>::Type&, const typename TRemoveReference<U>::Type&>::Type>;
&& CPartiallyOrdered<typename TCommonReference<const TRemoveReference<T>&, const TRemoveReference<U>&>::Type>
&& CEqualityComparable<typename TCommonReference<const TRemoveReference<T>&, const TRemoveReference<U>&>::Type>;
NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft)

View File

@ -28,30 +28,30 @@ NAMESPACE_PRIVATE_END
template <typename T> inline constexpr size_t ArrayRank = NAMESPACE_STD::rank_v<T>;
template <typename T, size_t I = 0> inline constexpr size_t ArrayExtent = NAMESPACE_STD::extent_v<T, I>;
template <typename T, typename U> concept CSameAs = NAMESPACE_STD::is_same_v<T, U>;
template <typename T, typename U> concept CBaseOf = NAMESPACE_STD::is_base_of_v<T, U>;
template <typename T, typename U> concept CConvertibleTo = NAMESPACE_STD::is_convertible_v<T, U>;
template <typename T, typename U> concept CSameAs = NAMESPACE_STD::is_same_v<T, U>;
template <typename T, typename U> concept CBaseOf = NAMESPACE_STD::is_base_of_v<T, U>;
template <typename T, typename U> concept CConvertibleTo = NAMESPACE_STD::is_convertible_v<T, U>;
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 TRemoveCV { using Type = NAMESPACE_STD::remove_cv_t<T>; };
template <typename T> struct TRemovePointer { using Type = NAMESPACE_STD::remove_pointer_t<T>; };
template <typename T> struct TRemoveReference { using Type = NAMESPACE_STD::remove_reference_t<T>; };
template <typename T> struct TRemoveCVRef { using Type = NAMESPACE_STD::remove_cvref_t<T>; };
template <typename T> struct TRemoveExtent { using Type = NAMESPACE_STD::remove_extent_t<T>; };
template <typename T> struct TRemoveAllExtents { using Type = NAMESPACE_STD::remove_all_extents_t<T>; };
template <typename T> using TRemoveConst = NAMESPACE_STD::remove_const_t<T>;
template <typename T> using TRemoveVolatile = NAMESPACE_STD::remove_volatile_t<T>;
template <typename T> using TRemoveCV = NAMESPACE_STD::remove_cv_t<T>;
template <typename T> using TRemovePointer = NAMESPACE_STD::remove_pointer_t<T>;
template <typename T> using TRemoveReference = NAMESPACE_STD::remove_reference_t<T>;
template <typename T> using TRemoveCVRef = NAMESPACE_STD::remove_cvref_t<T>;
template <typename T> using TRemoveExtent = NAMESPACE_STD::remove_extent_t<T>;
template <typename T> using TRemoveAllExtents = NAMESPACE_STD::remove_all_extents_t<T>;
template <typename T> struct TMakeSigned { using Type = NAMESPACE_STD::make_signed_t<T>; };
template <typename T> struct TMakeUnsigned { using Type = NAMESPACE_STD::make_unsigned_t<T>; };
template <typename T> using TMakeSigned = NAMESPACE_STD::make_signed_t<T>;
template <typename T> using TMakeUnsigned = NAMESPACE_STD::make_unsigned_t<T>;
template <size_t Size, size_t Align> struct TAlignedStorage { class Type { struct alignas(Align) { uint8 Pad[Size]; } Padding; }; };
template <size_t Size, typename... Types> struct TAlignedUnion { using Type = TAlignedStorage<NAMESPACE_PRIVATE::TMaximum<Size, sizeof(Types)...>::Value, NAMESPACE_PRIVATE::TMaximum<alignof(Types)...>::Value>::Type; };
template <typename T> struct TDecay { using Type = NAMESPACE_STD::decay_t<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 <typename T> struct TUnderlyingType { using Type = NAMESPACE_STD::underlying_type_t<T>; };
template <typename... Types> struct TVoid { using Type = void; };
template <typename T> struct TIdentity { using Type = T; };
template <size_t Size, size_t Align = 16> class TAlignedStorage { struct alignas(Align) { uint8 Pad[Size]; } Padding; };
template <size_t Size, typename... Types> using TAlignedUnion = TAlignedStorage<NAMESPACE_PRIVATE::TMaximum<Size, sizeof(Types)...>::Value, NAMESPACE_PRIVATE::TMaximum<alignof(Types)...>::Value>;
template <typename T> using TDecay = NAMESPACE_STD::decay_t<T>;
template <bool B, typename T = void> using TEnableIf = NAMESPACE_STD::enable_if_t<B, T>;
template <bool B, typename T, typename F> using TConditional = NAMESPACE_STD::conditional_t<B, T, F>;
template <typename T> using TUnderlyingType = NAMESPACE_STD::underlying_type_t<T>;
template <typename... Types> using TVoid = void;
template <typename T> using TIdentity = T;
NAMESPACE_MODULE_END(Utility)
NAMESPACE_MODULE_END(Redcraft)