style(*): enclose the requires expression in parentheses as required by GCC

This commit is contained in:
_Redstone_c_ 2022-11-16 22:03:54 +08:00
parent d37eee0d23
commit 3f56a2beca
15 changed files with 247 additions and 253 deletions

View File

@ -12,28 +12,28 @@ NAMESPACE_BEGIN(Memory)
constexpr bool IsValidAlignment(size_t Alignment) { return !(Alignment & (Alignment - 1)); } constexpr bool IsValidAlignment(size_t Alignment) { return !(Alignment & (Alignment - 1)); }
template <typename T> requires CIntegral<T> || CPointer<T> template <typename T> requires (CIntegral<T> || CPointer<T>)
FORCEINLINE constexpr T Align(T InValue, size_t Alignment) FORCEINLINE constexpr T Align(T InValue, size_t Alignment)
{ {
checkf(IsValidAlignment(Alignment), TEXT("The alignment value must be an integer power of 2.")); checkf(IsValidAlignment(Alignment), TEXT("The alignment value must be an integer power of 2."));
return (T)(((uint64)(InValue) + static_cast<uint64>(Alignment) - 1) & ~(static_cast<uint64>(Alignment) - 1)); return (T)(((uint64)(InValue) + static_cast<uint64>(Alignment) - 1) & ~(static_cast<uint64>(Alignment) - 1));
} }
template <typename T> requires CIntegral<T> || CPointer<T> template <typename T> requires (CIntegral<T> || CPointer<T>)
FORCEINLINE constexpr T AlignDown(T InValue, size_t Alignment) FORCEINLINE constexpr T AlignDown(T InValue, size_t Alignment)
{ {
checkf(IsValidAlignment(Alignment), TEXT("The alignment value must be an integer power of 2.")); checkf(IsValidAlignment(Alignment), TEXT("The alignment value must be an integer power of 2."));
return (T)((uint64)(InValue) & ~(static_cast<uint64>(Alignment) - 1)); return (T)((uint64)(InValue) & ~(static_cast<uint64>(Alignment) - 1));
} }
template <typename T> requires CIntegral<T> || CPointer<T> template <typename T> requires (CIntegral<T> || CPointer<T>)
FORCEINLINE constexpr T AlignArbitrary(T InValue, size_t Alignment) FORCEINLINE constexpr T AlignArbitrary(T InValue, size_t Alignment)
{ {
checkf(IsValidAlignment(Alignment), TEXT("The alignment value must be an integer power of 2.")); checkf(IsValidAlignment(Alignment), TEXT("The alignment value must be an integer power of 2."));
return (T)((((uint64)(InValue) + static_cast<uint64>(Alignment) - 1) / static_cast<uint64>(Alignment)) * static_cast<uint64>(Alignment)); return (T)((((uint64)(InValue) + static_cast<uint64>(Alignment) - 1) / static_cast<uint64>(Alignment)) * static_cast<uint64>(Alignment));
} }
template <typename T> requires CIntegral<T> || CPointer<T> template <typename T> requires (CIntegral<T> || CPointer<T>)
FORCEINLINE constexpr bool IsAligned(T InValue, size_t Alignment) FORCEINLINE constexpr bool IsAligned(T InValue, size_t Alignment)
{ {
checkf(IsValidAlignment(Alignment), TEXT("The alignment value must be an integer power of 2.")); checkf(IsValidAlignment(Alignment), TEXT("The alignment value must be an integer power of 2."));

View File

@ -11,8 +11,7 @@ NAMESPACE_MODULE_BEGIN(Utility)
NAMESPACE_BEGIN(Memory) NAMESPACE_BEGIN(Memory)
template <typename ElementType> template <CDefaultConstructible ElementType>
requires CDefaultConstructible<ElementType>
FORCEINLINE void DefaultConstruct(void* Address, size_t Count = 1) FORCEINLINE void DefaultConstruct(void* Address, size_t Count = 1)
{ {
if constexpr (!CTriviallyDefaultConstructible<ElementType>) if constexpr (!CTriviallyDefaultConstructible<ElementType>)
@ -27,7 +26,7 @@ FORCEINLINE void DefaultConstruct(void* Address, size_t Count = 1)
} }
template <typename DestinationElementType, typename SourceElementType = DestinationElementType> template <typename DestinationElementType, typename SourceElementType = DestinationElementType>
requires CConstructibleFrom<DestinationElementType, const SourceElementType&> requires (CConstructibleFrom<DestinationElementType, const SourceElementType&>)
FORCEINLINE void Construct(void* Destination, const SourceElementType* Source, size_t Count = 1) FORCEINLINE void Construct(void* Destination, const SourceElementType* Source, size_t Count = 1)
{ {
if constexpr (CTriviallyConstructibleFrom<DestinationElementType, const SourceElementType> && sizeof(DestinationElementType) == sizeof(SourceElementType)) if constexpr (CTriviallyConstructibleFrom<DestinationElementType, const SourceElementType> && sizeof(DestinationElementType) == sizeof(SourceElementType))
@ -46,8 +45,7 @@ FORCEINLINE void Construct(void* Destination, const SourceElementType* Source, s
} }
} }
template <typename ElementType> template <CCopyConstructible ElementType>
requires CCopyConstructible<ElementType>
FORCEINLINE void CopyConstruct(void* Destination, const ElementType* Source, size_t Count = 1) FORCEINLINE void CopyConstruct(void* Destination, const ElementType* Source, size_t Count = 1)
{ {
if constexpr (CTriviallyCopyConstructible<ElementType>) if constexpr (CTriviallyCopyConstructible<ElementType>)
@ -66,8 +64,7 @@ FORCEINLINE void CopyConstruct(void* Destination, const ElementType* Source, siz
} }
} }
template <typename ElementType> template <CMoveConstructible ElementType>
requires CMoveConstructible<ElementType>
FORCEINLINE void MoveConstruct(void* Destination, ElementType* Source, size_t Count = 1) FORCEINLINE void MoveConstruct(void* Destination, ElementType* Source, size_t Count = 1)
{ {
if constexpr (CTriviallyMoveConstructible<ElementType>) if constexpr (CTriviallyMoveConstructible<ElementType>)
@ -86,8 +83,7 @@ FORCEINLINE void MoveConstruct(void* Destination, ElementType* Source, size_t Co
} }
} }
template <typename ElementType> template <CCopyAssignable ElementType>
requires CCopyAssignable<ElementType>
FORCEINLINE void CopyAssign(ElementType* Destination, const ElementType* Source, size_t Count = 1) FORCEINLINE void CopyAssign(ElementType* Destination, const ElementType* Source, size_t Count = 1)
{ {
if constexpr (CTriviallyCopyAssignable<ElementType>) if constexpr (CTriviallyCopyAssignable<ElementType>)
@ -106,8 +102,7 @@ FORCEINLINE void CopyAssign(ElementType* Destination, const ElementType* Source,
} }
} }
template <typename ElementType> template <CMoveAssignable ElementType>
requires CMoveAssignable<ElementType>
FORCEINLINE void MoveAssign(ElementType* Destination, ElementType* Source, size_t Count = 1) FORCEINLINE void MoveAssign(ElementType* Destination, ElementType* Source, size_t Count = 1)
{ {
if constexpr (CTriviallyMoveAssignable<ElementType>) if constexpr (CTriviallyMoveAssignable<ElementType>)
@ -126,8 +121,7 @@ FORCEINLINE void MoveAssign(ElementType* Destination, ElementType* Source, size_
} }
} }
template <typename ElementType> template <CDestructible ElementType>
requires CDestructible<ElementType>
FORCEINLINE void Destruct(ElementType* Element, size_t Count = 1) FORCEINLINE void Destruct(ElementType* Element, size_t Count = 1)
{ {
if constexpr (!CTriviallyDestructible<ElementType>) if constexpr (!CTriviallyDestructible<ElementType>)

View File

@ -56,13 +56,13 @@ concept CThreeWayComparable = CWeaklyEqualityComparable<T, U> && CPartiallyOrder
{ C <=> C } -> CThreeWayComparesAs<OrderingType>; { C <=> C } -> CThreeWayComparesAs<OrderingType>;
}; };
template <typename T, typename U = T> requires CThreeWayComparable<T, U> template <typename T, typename U = T> requires (CThreeWayComparable<T, U>)
using TCompareThreeWayResult = decltype(DeclVal<const TRemoveReference<T>&>() <=> DeclVal<const TRemoveReference<U>&>()); using TCompareThreeWayResult = decltype(DeclVal<const TRemoveReference<T>&>() <=> DeclVal<const TRemoveReference<U>&>());
template <typename T, typename U = T, typename OrderingType = partial_ordering> template <typename T, typename U = T, typename OrderingType = partial_ordering>
concept CSynthThreeWayComparable = CThreeWayComparable<T, U> || CTotallyOrdered<T, U>; concept CSynthThreeWayComparable = CThreeWayComparable<T, U> || CTotallyOrdered<T, U>;
template <typename T, typename U = T> requires CSynthThreeWayComparable<T, U> template <typename T, typename U = T> requires (CSynthThreeWayComparable<T, U>)
constexpr decltype(auto) SynthThreeWayCompare(T&& LHS, U&& RHS) constexpr decltype(auto) SynthThreeWayCompare(T&& LHS, U&& RHS)
{ {
if constexpr (CThreeWayComparable<T, U>) if constexpr (CThreeWayComparable<T, U>)
@ -75,7 +75,7 @@ constexpr decltype(auto) SynthThreeWayCompare(T&& LHS, U&& RHS)
} }
} }
template <typename T, typename U = T> requires CSynthThreeWayComparable<T, U> template <typename T, typename U = T> requires (CSynthThreeWayComparable<T, U>)
using TSynthThreeWayResult = decltype(SynthThreeWayCompare(DeclVal<const TRemoveReference<T>&>(), DeclVal<const TRemoveReference<U>&>())); using TSynthThreeWayResult = decltype(SynthThreeWayCompare(DeclVal<const TRemoveReference<T>&>(), DeclVal<const TRemoveReference<U>&>()));
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)

View File

@ -13,11 +13,11 @@ NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility) NAMESPACE_MODULE_BEGIN(Utility)
// TAny's CustomStorage concept, see FAnyDefaultStorage. // TAny's CustomStorage concept, see FAnyDefaultStorage
template <typename T> template <typename T>
concept CAnyCustomStorage = concept CAnyCustomStorage =
// CSameAs<decltype(T::InlineSize), const size_t> && CSameAs<decltype(T::InlineSize), const size_t> &&
// CSameAs<decltype(T::InlineAlignment), const size_t> && CSameAs<decltype(T::InlineAlignment), const size_t> &&
requires(const T& A) requires(const T& A)
{ {
{ A.InlineAllocation() } -> CSameAs<const void*>; { A.InlineAllocation() } -> CSameAs<const void*>;
@ -36,12 +36,12 @@ concept CAnyCustomStorage =
A.MoveCustom(MoveTemp(C)); A.MoveCustom(MoveTemp(C));
}; };
// TAny's default storage structure. // TAny's default storage structure
struct alignas(16) FAnyDefaultStorage struct alignas(16) FAnyDefaultStorage
{ {
// The built-in copy/move operators are disabled and CopyCustom/MoveCustom is used instead of them. // The built-in copy/move operators are disabled and CopyCustom/MoveCustom is used instead of them
// You can add custom variables like this. // You can add custom variables like this
//Type Variable; //Type Variable;
//~ Begin CAnyCustomStorage Interface //~ Begin CAnyCustomStorage Interface
@ -53,8 +53,8 @@ struct alignas(16) FAnyDefaultStorage
constexpr void* HeapAllocation() const { return HeapAllocationImpl; } constexpr void* HeapAllocation() const { return HeapAllocationImpl; }
constexpr uintptr& TypeInfo() { return TypeInfoImpl; } constexpr uintptr& TypeInfo() { return TypeInfoImpl; }
constexpr uintptr TypeInfo() const { return TypeInfoImpl; } constexpr uintptr TypeInfo() const { return TypeInfoImpl; }
constexpr void CopyCustom(const FAnyDefaultStorage& InValue) { /* Variable = InValue.Variable; */ } // You just need to copy the custom variables. constexpr void CopyCustom(const FAnyDefaultStorage& InValue) { /* Variable = InValue.Variable; */ } // You just need to copy the custom variables
constexpr void MoveCustom( FAnyDefaultStorage&& InValue) { /* Variable = MoveTemp(InValue.Variable); */ } // You just need to move the custom variables. constexpr void MoveCustom( FAnyDefaultStorage&& InValue) { /* Variable = MoveTemp(InValue.Variable); */ } // You just need to move the custom variables
//~ End CAnyCustomStorage Interface //~ End CAnyCustomStorage Interface
union union
@ -69,8 +69,8 @@ struct alignas(16) FAnyDefaultStorage
static_assert(CAnyCustomStorage<FAnyDefaultStorage>); static_assert(CAnyCustomStorage<FAnyDefaultStorage>);
// You can add custom storage area through CustomStorage, such as TFunction. // You can add custom storage area through CustomStorage, such as TFunction
// It is not recommended to use this, FAny is recommended. // It is not recommended to use this, FAny is recommended
template <CAnyCustomStorage CustomStorage = FAnyDefaultStorage> template <CAnyCustomStorage CustomStorage = FAnyDefaultStorage>
class TAny class TAny
{ {
@ -131,15 +131,15 @@ public:
} }
} }
template <typename T, typename... Ts> requires CDestructible<TDecay<T>> template <typename T, typename... Ts> requires (CDestructible<TDecay<T>>
&& CConstructibleFrom<TDecay<T>, Ts&&...> && CConstructibleFrom<TDecay<T>, Ts&&...>)
FORCEINLINE explicit TAny(TInPlaceType<T>, Ts&&... Args) FORCEINLINE explicit TAny(TInPlaceType<T>, Ts&&... Args)
{ {
using SelectedType = TDecay<T>; using SelectedType = TDecay<T>;
EmplaceImpl<SelectedType>(Forward<Ts>(Args)...); EmplaceImpl<SelectedType>(Forward<Ts>(Args)...);
} }
template <typename T> requires (!CSameAs<TDecay<T>, TAny>) && (!CTInPlaceType<TDecay<T>>) template <typename T> requires (!CSameAs<TDecay<T>, TAny> && !CTInPlaceType<TDecay<T>>)
&& CDestructible<TDecay<T>> && CConstructibleFrom<TDecay<T>, T&&> && CDestructible<TDecay<T>> && CConstructibleFrom<TDecay<T>, T&&>
FORCEINLINE TAny(T&& InValue) : TAny(InPlaceType<TDecay<T>>, Forward<T>(InValue)) FORCEINLINE TAny(T&& InValue) : TAny(InPlaceType<TDecay<T>>, Forward<T>(InValue))
{ } { }
@ -251,7 +251,7 @@ public:
return *this; return *this;
} }
template <typename T> requires (!CSameAs<TDecay<T>, TAny>) && (!CTInPlaceType<TDecay<T>>) template <typename T> requires (!CSameAs<TDecay<T>, TAny> && !CTInPlaceType<TDecay<T>>)
&& CDestructible<TDecay<T>> && CConstructibleFrom<TDecay<T>, T&&> && CDestructible<TDecay<T>> && CConstructibleFrom<TDecay<T>, T&&>
FORCEINLINE TAny& operator=(T&& InValue) FORCEINLINE TAny& operator=(T&& InValue)
{ {
@ -270,8 +270,8 @@ public:
return *this; return *this;
} }
template <typename T, typename... Ts> requires CDestructible<TDecay<T>> template <typename T, typename... Ts> requires (CDestructible<TDecay<T>>
&& CConstructibleFrom<TDecay<T>, Ts&&...> && CConstructibleFrom<TDecay<T>, Ts&&...>)
FORCEINLINE TDecay<T>& Emplace(Ts&&... Args) FORCEINLINE TDecay<T>& Emplace(Ts&&... Args)
{ {
ResetImpl(); ResetImpl();
@ -288,22 +288,22 @@ public:
template <typename T> constexpr bool HoldsAlternative() const { return IsValid() ? GetTypeInfo() == typeid(T) : false; } template <typename T> constexpr bool HoldsAlternative() const { return IsValid() ? GetTypeInfo() == typeid(T) : false; }
template <typename T> requires CDestructible<TDecay<T>> 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()); } 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<TDecay<T>> 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())); } 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<TDecay<T>> 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()); } 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<TDecay<T>> 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())); } 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, TDecay<T>>&& CDestructible<TDecay<T>> template <typename T> requires (CSameAs<T, TDecay<T>> && CDestructible<TDecay<T>>)
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 CSameAs<T, TDecay<T>>&& CDestructible<TDecay<T>> 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; } constexpr const T& Get(const T& DefaultValue) const& { return HoldsAlternative<T>() ? GetValue<T>() : DefaultValue; }
constexpr CustomStorage& GetCustomStorage() requires (!CSameAs<CustomStorage, FAnyDefaultStorage>) { return Storage; } constexpr CustomStorage& GetCustomStorage() requires (!CSameAs<CustomStorage, FAnyDefaultStorage>) { return Storage; }

View File

@ -51,9 +51,9 @@ NAMESPACE_PRIVATE_END
#endif #endif
template <typename T, bool bIsRef = false> requires CTriviallyCopyable<T> template <typename T, bool bIsRef = false> requires (CTriviallyCopyable<T>
&& CCopyConstructible<T> && CMoveConstructible<T> && CCopyConstructible<T> && CMoveConstructible<T>
&& CCopyAssignable<T> && CMoveAssignable<T> && CCopyAssignable<T> && CMoveAssignable<T>)
struct TAtomic : public FSingleton struct TAtomic : public FSingleton
{ {
protected: protected:
@ -75,19 +75,19 @@ public:
FORCEINLINE TAtomic(TAtomic& InValue) requires (bIsRef) : Element(InValue) { }; FORCEINLINE TAtomic(TAtomic& InValue) requires (bIsRef) : Element(InValue) { };
FORCEINLINE ValueType operator=(ValueType Desired) { return Element = Desired; } FORCEINLINE ValueType operator=(ValueType Desired) { return Element = Desired; }
FORCEINLINE ValueType operator=(ValueType Desired) volatile requires bIsAlwaysLockFree { return Element = Desired; } FORCEINLINE ValueType operator=(ValueType Desired) volatile requires (bIsAlwaysLockFree) { return Element = Desired; }
FORCEINLINE void Store(ValueType Desired, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) { MEMORY_ORDER_CHECK(Order, 0x01 | 0x08 | 0x20); Element.store(Desired, static_cast<NAMESPACE_STD::memory_order>(Order)); } FORCEINLINE void Store(ValueType Desired, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) { MEMORY_ORDER_CHECK(Order, 0x01 | 0x08 | 0x20); Element.store(Desired, static_cast<NAMESPACE_STD::memory_order>(Order)); }
FORCEINLINE void Store(ValueType Desired, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires bIsAlwaysLockFree { MEMORY_ORDER_CHECK(Order, 0x01 | 0x08 | 0x20); Element.store(Desired, static_cast<NAMESPACE_STD::memory_order>(Order)); } FORCEINLINE void Store(ValueType Desired, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires (bIsAlwaysLockFree) { MEMORY_ORDER_CHECK(Order, 0x01 | 0x08 | 0x20); Element.store(Desired, static_cast<NAMESPACE_STD::memory_order>(Order)); }
FORCEINLINE ValueType Load(EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) const { MEMORY_ORDER_CHECK(Order, 0x01 | 0x02 | 0x04 | 0x20); return Element.load(static_cast<NAMESPACE_STD::memory_order>(Order)); } FORCEINLINE ValueType Load(EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) const { MEMORY_ORDER_CHECK(Order, 0x01 | 0x02 | 0x04 | 0x20); return Element.load(static_cast<NAMESPACE_STD::memory_order>(Order)); }
FORCEINLINE ValueType Load(EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) const volatile requires bIsAlwaysLockFree { MEMORY_ORDER_CHECK(Order, 0x01 | 0x02 | 0x04 | 0x20); return Element.load(static_cast<NAMESPACE_STD::memory_order>(Order)); } FORCEINLINE ValueType Load(EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) const volatile requires (bIsAlwaysLockFree) { MEMORY_ORDER_CHECK(Order, 0x01 | 0x02 | 0x04 | 0x20); return Element.load(static_cast<NAMESPACE_STD::memory_order>(Order)); }
FORCEINLINE operator ValueType() const { return static_cast<ValueType>(Element); } FORCEINLINE operator ValueType() const { return static_cast<ValueType>(Element); }
FORCEINLINE operator ValueType() const volatile requires bIsAlwaysLockFree { return static_cast<ValueType>(Element); } FORCEINLINE operator ValueType() const volatile requires (bIsAlwaysLockFree) { return static_cast<ValueType>(Element); }
FORCEINLINE ValueType Exchange(ValueType Desired, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) { return Element.exchange(Desired, static_cast<NAMESPACE_STD::memory_order>(Order)); } FORCEINLINE ValueType Exchange(ValueType Desired, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) { return Element.exchange(Desired, static_cast<NAMESPACE_STD::memory_order>(Order)); }
FORCEINLINE ValueType Exchange(ValueType Desired, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires bIsAlwaysLockFree { return Element.exchange(Desired, static_cast<NAMESPACE_STD::memory_order>(Order)); } FORCEINLINE ValueType Exchange(ValueType Desired, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires (bIsAlwaysLockFree) { return Element.exchange(Desired, static_cast<NAMESPACE_STD::memory_order>(Order)); }
FORCEINLINE bool CompareExchange(ValueType& Expected, ValueType Desired, EMemoryOrder Success, EMemoryOrder Failure, bool bIsWeak = false) FORCEINLINE bool CompareExchange(ValueType& Expected, ValueType Desired, EMemoryOrder Success, EMemoryOrder Failure, bool bIsWeak = false)
{ {
@ -96,7 +96,7 @@ public:
else return Element.compare_exchange_strong(Expected, Desired, static_cast<NAMESPACE_STD::memory_order>(Success), static_cast<NAMESPACE_STD::memory_order>(Failure)); else return Element.compare_exchange_strong(Expected, Desired, static_cast<NAMESPACE_STD::memory_order>(Success), static_cast<NAMESPACE_STD::memory_order>(Failure));
} }
FORCEINLINE bool CompareExchange(ValueType& Expected, ValueType Desired, EMemoryOrder Success, EMemoryOrder Failure, bool bIsWeak = false) volatile requires bIsAlwaysLockFree FORCEINLINE bool CompareExchange(ValueType& Expected, ValueType Desired, EMemoryOrder Success, EMemoryOrder Failure, bool bIsWeak = false) volatile requires (bIsAlwaysLockFree)
{ {
MEMORY_ORDER_CHECK(Failure, 0x01 | 0x02 | 0x04 | 0x20); MEMORY_ORDER_CHECK(Failure, 0x01 | 0x02 | 0x04 | 0x20);
if (bIsWeak) return Element.compare_exchange_weak(Expected, Desired, static_cast<NAMESPACE_STD::memory_order>(Success), static_cast<NAMESPACE_STD::memory_order>(Failure)); if (bIsWeak) return Element.compare_exchange_weak(Expected, Desired, static_cast<NAMESPACE_STD::memory_order>(Success), static_cast<NAMESPACE_STD::memory_order>(Failure));
@ -109,7 +109,7 @@ public:
else return Element.compare_exchange_strong(Expected, Desired, static_cast<NAMESPACE_STD::memory_order>(Order)); else return Element.compare_exchange_strong(Expected, Desired, static_cast<NAMESPACE_STD::memory_order>(Order));
} }
FORCEINLINE bool CompareExchange(ValueType& Expected, ValueType Desired, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent, bool bIsWeak = false) volatile requires bIsAlwaysLockFree FORCEINLINE bool CompareExchange(ValueType& Expected, ValueType Desired, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent, bool bIsWeak = false) volatile requires (bIsAlwaysLockFree)
{ {
if (bIsWeak) return Element.compare_exchange_weak(Expected, Desired, static_cast<NAMESPACE_STD::memory_order>(Order)); if (bIsWeak) return Element.compare_exchange_weak(Expected, Desired, static_cast<NAMESPACE_STD::memory_order>(Order));
else return Element.compare_exchange_strong(Expected, Desired, static_cast<NAMESPACE_STD::memory_order>(Order)); else return Element.compare_exchange_strong(Expected, Desired, static_cast<NAMESPACE_STD::memory_order>(Order));
@ -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 CInvocableResult<ValueType, F, ValueType> 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 CInvocableResult<ValueType, F, ValueType> && 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));
@ -140,14 +140,14 @@ public:
FORCEINLINE ValueType FetchAdd(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires (CIntegral<T> || CFloatingPoint<T>) { return Element.fetch_add(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); } FORCEINLINE ValueType FetchAdd(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires (CIntegral<T> || CFloatingPoint<T>) { return Element.fetch_add(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); }
FORCEINLINE ValueType FetchAdd(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires (CIntegral<T> || CFloatingPoint<T>) && bIsAlwaysLockFree { return Element.fetch_add(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); } FORCEINLINE ValueType FetchAdd(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires (CIntegral<T> || CFloatingPoint<T>) && bIsAlwaysLockFree { return Element.fetch_add(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); }
FORCEINLINE ValueType FetchAdd(ptrdiff InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires CPointer<T> { return Element.fetch_add(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); } FORCEINLINE ValueType FetchAdd(ptrdiff InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires (CPointer<T> ) { return Element.fetch_add(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); }
FORCEINLINE ValueType FetchAdd(ptrdiff InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires CPointer<T> && bIsAlwaysLockFree { return Element.fetch_add(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); } FORCEINLINE ValueType FetchAdd(ptrdiff InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires (CPointer<T> && bIsAlwaysLockFree) { return Element.fetch_add(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); }
FORCEINLINE ValueType FetchSub(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires (CIntegral<T> || CFloatingPoint<T>) { return Element.fetch_sub(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); } FORCEINLINE ValueType FetchSub(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires (CIntegral<T> || CFloatingPoint<T>) { return Element.fetch_sub(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); }
FORCEINLINE ValueType FetchSub(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires (CIntegral<T> || CFloatingPoint<T>) && bIsAlwaysLockFree { return Element.fetch_sub(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); } FORCEINLINE ValueType FetchSub(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires (CIntegral<T> || CFloatingPoint<T>) && bIsAlwaysLockFree { return Element.fetch_sub(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); }
FORCEINLINE ValueType FetchSub(ptrdiff InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires CPointer<T> { return Element.fetch_sub(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); } FORCEINLINE ValueType FetchSub(ptrdiff InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires (CPointer<T> ) { return Element.fetch_sub(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); }
FORCEINLINE ValueType FetchSub(ptrdiff InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires CPointer<T> && bIsAlwaysLockFree { return Element.fetch_sub(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); } FORCEINLINE ValueType FetchSub(ptrdiff InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires (CPointer<T> && bIsAlwaysLockFree) { return Element.fetch_sub(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); }
FORCEINLINE ValueType FetchMul(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires (CIntegral<T> || CFloatingPoint<T>) { return FetchFn([InValue](ValueType Old) -> ValueType { return Old * InValue; }); } FORCEINLINE ValueType FetchMul(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires (CIntegral<T> || CFloatingPoint<T>) { return FetchFn([InValue](ValueType Old) -> ValueType { return Old * InValue; }); }
FORCEINLINE ValueType FetchMul(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires (CIntegral<T> || CFloatingPoint<T>) && bIsAlwaysLockFree { return FetchFn([InValue](ValueType Old) -> ValueType { return Old * InValue; }); } FORCEINLINE ValueType FetchMul(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires (CIntegral<T> || CFloatingPoint<T>) && bIsAlwaysLockFree { return FetchFn([InValue](ValueType Old) -> ValueType { return Old * InValue; }); }
@ -155,71 +155,71 @@ public:
FORCEINLINE ValueType FetchDiv(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires (CIntegral<T> || CFloatingPoint<T>) { return FetchFn([InValue](ValueType Old) -> ValueType { return Old / InValue; }); } FORCEINLINE ValueType FetchDiv(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires (CIntegral<T> || CFloatingPoint<T>) { return FetchFn([InValue](ValueType Old) -> ValueType { return Old / InValue; }); }
FORCEINLINE ValueType FetchDiv(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires (CIntegral<T> || CFloatingPoint<T>) && bIsAlwaysLockFree { return FetchFn([InValue](ValueType Old) -> ValueType { return Old / InValue; }); } FORCEINLINE ValueType FetchDiv(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires (CIntegral<T> || CFloatingPoint<T>) && bIsAlwaysLockFree { return FetchFn([InValue](ValueType Old) -> ValueType { return Old / InValue; }); }
FORCEINLINE ValueType FetchMod(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires CIntegral<T> { return FetchFn([InValue](ValueType Old) -> ValueType { return Old % InValue; }); } FORCEINLINE ValueType FetchMod(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires (CIntegral<T> ) { return FetchFn([InValue](ValueType Old) -> ValueType { return Old % InValue; }); }
FORCEINLINE ValueType FetchMod(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires CIntegral<T> && bIsAlwaysLockFree { return FetchFn([InValue](ValueType Old) -> ValueType { return Old % InValue; }); } FORCEINLINE ValueType FetchMod(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires (CIntegral<T> && bIsAlwaysLockFree) { return FetchFn([InValue](ValueType Old) -> ValueType { return Old % InValue; }); }
FORCEINLINE ValueType FetchAnd(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires CIntegral<T> { return Element.fetch_and(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); } FORCEINLINE ValueType FetchAnd(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires (CIntegral<T> ) { return Element.fetch_and(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); }
FORCEINLINE ValueType FetchAnd(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires CIntegral<T> && bIsAlwaysLockFree { return Element.fetch_and(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); } FORCEINLINE ValueType FetchAnd(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires (CIntegral<T> && bIsAlwaysLockFree) { return Element.fetch_and(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); }
FORCEINLINE ValueType FetchOr(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires CIntegral<T> { return Element.fetch_or(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); } FORCEINLINE ValueType FetchOr(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires (CIntegral<T> ) { return Element.fetch_or(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); }
FORCEINLINE ValueType FetchOr(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires CIntegral<T> && bIsAlwaysLockFree { return Element.fetch_or(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); } FORCEINLINE ValueType FetchOr(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires (CIntegral<T> && bIsAlwaysLockFree) { return Element.fetch_or(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); }
FORCEINLINE ValueType FetchXor(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires CIntegral<T> { return Element.fetch_xor(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); } FORCEINLINE ValueType FetchXor(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires (CIntegral<T> ) { return Element.fetch_xor(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); }
FORCEINLINE ValueType FetchXor(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires CIntegral<T> && bIsAlwaysLockFree { return Element.fetch_xor(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); } FORCEINLINE ValueType FetchXor(ValueType InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires (CIntegral<T> && bIsAlwaysLockFree) { return Element.fetch_xor(InValue, static_cast<NAMESPACE_STD::memory_order>(Order)); }
FORCEINLINE ValueType FetchLsh(size_t InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires CIntegral<T> { return FetchFn([InValue](ValueType Old) -> ValueType { return Old << InValue; }); } FORCEINLINE ValueType FetchLsh(size_t InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires (CIntegral<T> ) { return FetchFn([InValue](ValueType Old) -> ValueType { return Old << InValue; }); }
FORCEINLINE ValueType FetchLsh(size_t InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires CIntegral<T> && bIsAlwaysLockFree { return FetchFn([InValue](ValueType Old) -> ValueType { return Old << InValue; }); } FORCEINLINE ValueType FetchLsh(size_t InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires (CIntegral<T> && bIsAlwaysLockFree) { return FetchFn([InValue](ValueType Old) -> ValueType { return Old << InValue; }); }
FORCEINLINE ValueType FetchRsh(size_t InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires CIntegral<T> { return FetchFn([InValue](ValueType Old) -> ValueType { return Old >> InValue; }); } FORCEINLINE ValueType FetchRsh(size_t InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) requires (CIntegral<T> ) { return FetchFn([InValue](ValueType Old) -> ValueType { return Old >> InValue; }); }
FORCEINLINE ValueType FetchRsh(size_t InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires CIntegral<T> && bIsAlwaysLockFree { return FetchFn([InValue](ValueType Old) -> ValueType { return Old >> InValue; }); } FORCEINLINE ValueType FetchRsh(size_t InValue, EMemoryOrder Order = EMemoryOrder::SequentiallyConsistent) volatile requires (CIntegral<T> && bIsAlwaysLockFree) { return FetchFn([InValue](ValueType Old) -> ValueType { return Old >> InValue; }); }
FORCEINLINE ValueType operator++() requires (CIntegral<T> || CPointer<T>) { return ++Element; } FORCEINLINE ValueType operator++() requires ((CIntegral<T> || CPointer<T>) ) { return ++Element; }
FORCEINLINE ValueType operator++() volatile requires (CIntegral<T> || CPointer<T>) && bIsAlwaysLockFree { return ++Element; } FORCEINLINE ValueType operator++() volatile requires ((CIntegral<T> || CPointer<T>) && bIsAlwaysLockFree) { return ++Element; }
FORCEINLINE ValueType operator++(int) requires (CIntegral<T> || CPointer<T>) { return Element++; } FORCEINLINE ValueType operator++(int) requires ((CIntegral<T> || CPointer<T>) ) { return Element++; }
FORCEINLINE ValueType operator++(int) volatile requires (CIntegral<T> || CPointer<T>) && bIsAlwaysLockFree { return Element++; } FORCEINLINE ValueType operator++(int) volatile requires ((CIntegral<T> || CPointer<T>) && bIsAlwaysLockFree) { return Element++; }
FORCEINLINE ValueType operator--() requires (CIntegral<T> || CPointer<T>) { return --Element; } FORCEINLINE ValueType operator--() requires ((CIntegral<T> || CPointer<T>) ) { return --Element; }
FORCEINLINE ValueType operator--() volatile requires (CIntegral<T> || CPointer<T>) && bIsAlwaysLockFree { return --Element; } FORCEINLINE ValueType operator--() volatile requires ((CIntegral<T> || CPointer<T>) && bIsAlwaysLockFree) { return --Element; }
FORCEINLINE ValueType operator--(int) requires (CIntegral<T> || CPointer<T>) { return Element--; } FORCEINLINE ValueType operator--(int) requires ((CIntegral<T> || CPointer<T>) ) { return Element--; }
FORCEINLINE ValueType operator--(int) volatile requires (CIntegral<T> || CPointer<T>) && bIsAlwaysLockFree { return Element--; } FORCEINLINE ValueType operator--(int) volatile requires ((CIntegral<T> || CPointer<T>) && bIsAlwaysLockFree) { return Element--; }
FORCEINLINE ValueType operator+=(ValueType InValue) requires (CIntegral<T> || CFloatingPoint<T>) { return Element += InValue; } FORCEINLINE ValueType operator+=(ValueType InValue) requires ((CIntegral<T> || CFloatingPoint<T>) ) { return Element += InValue; }
FORCEINLINE ValueType operator+=(ValueType InValue) volatile requires (CIntegral<T> || CFloatingPoint<T>) && bIsAlwaysLockFree { return Element += InValue; } FORCEINLINE ValueType operator+=(ValueType InValue) volatile requires ((CIntegral<T> || CFloatingPoint<T>) && bIsAlwaysLockFree) { return Element += InValue; }
FORCEINLINE ValueType operator+=(ptrdiff InValue) requires CPointer<T> { return Element += InValue; } FORCEINLINE ValueType operator+=(ptrdiff InValue) requires (CPointer<T> ) { return Element += InValue; }
FORCEINLINE ValueType operator+=(ptrdiff InValue) volatile requires CPointer<T> && bIsAlwaysLockFree { return Element += InValue; } FORCEINLINE ValueType operator+=(ptrdiff InValue) volatile requires (CPointer<T> && bIsAlwaysLockFree) { return Element += InValue; }
FORCEINLINE ValueType operator-=(ValueType InValue) requires (CIntegral<T> || CFloatingPoint<T>) { return Element -= InValue; } FORCEINLINE ValueType operator-=(ValueType InValue) requires ((CIntegral<T> || CFloatingPoint<T>) ) { return Element -= InValue; }
FORCEINLINE ValueType operator-=(ValueType InValue) volatile requires (CIntegral<T> || CFloatingPoint<T>) && bIsAlwaysLockFree { return Element -= InValue; } FORCEINLINE ValueType operator-=(ValueType InValue) volatile requires ((CIntegral<T> || CFloatingPoint<T>) && bIsAlwaysLockFree) { return Element -= InValue; }
FORCEINLINE ValueType operator-=(ptrdiff InValue) requires CPointer<T> { return Element -= InValue; } FORCEINLINE ValueType operator-=(ptrdiff InValue) requires (CPointer<T> ) { return Element -= InValue; }
FORCEINLINE ValueType operator-=(ptrdiff InValue) volatile requires CPointer<T> && bIsAlwaysLockFree { return Element -= InValue; } FORCEINLINE ValueType operator-=(ptrdiff InValue) volatile requires (CPointer<T> && bIsAlwaysLockFree) { return Element -= InValue; }
FORCEINLINE ValueType operator*=(ValueType InValue) requires (CIntegral<T> || CFloatingPoint<T>) { return FetchMul(InValue) * InValue; } FORCEINLINE ValueType operator*=(ValueType InValue) requires ((CIntegral<T> || CFloatingPoint<T>) ) { return FetchMul(InValue) * InValue; }
FORCEINLINE ValueType operator*=(ValueType InValue) volatile requires (CIntegral<T> || CFloatingPoint<T>) && bIsAlwaysLockFree { return FetchMul(InValue) * InValue; } FORCEINLINE ValueType operator*=(ValueType InValue) volatile requires ((CIntegral<T> || CFloatingPoint<T>) && bIsAlwaysLockFree) { return FetchMul(InValue) * InValue; }
FORCEINLINE ValueType operator/=(ValueType InValue) requires (CIntegral<T> || CFloatingPoint<T>) { return FetchDiv(InValue) / InValue; } FORCEINLINE ValueType operator/=(ValueType InValue) requires ((CIntegral<T> || CFloatingPoint<T>) ) { return FetchDiv(InValue) / InValue; }
FORCEINLINE ValueType operator/=(ValueType InValue) volatile requires (CIntegral<T> || CFloatingPoint<T>) && bIsAlwaysLockFree { return FetchDiv(InValue) / InValue; } FORCEINLINE ValueType operator/=(ValueType InValue) volatile requires ((CIntegral<T> || CFloatingPoint<T>) && bIsAlwaysLockFree) { return FetchDiv(InValue) / InValue; }
FORCEINLINE ValueType operator%=(ValueType InValue) requires CIntegral<T> { return FetchMod(InValue) % InValue; } FORCEINLINE ValueType operator%=(ValueType InValue) requires (CIntegral<T> ) { return FetchMod(InValue) % InValue; }
FORCEINLINE ValueType operator%=(ValueType InValue) volatile requires CIntegral<T> && bIsAlwaysLockFree { return FetchMod(InValue) % InValue; } FORCEINLINE ValueType operator%=(ValueType InValue) volatile requires (CIntegral<T> && bIsAlwaysLockFree) { return FetchMod(InValue) % InValue; }
FORCEINLINE ValueType operator&=(ValueType InValue) requires CIntegral<T> { return Element &= InValue; } FORCEINLINE ValueType operator&=(ValueType InValue) requires (CIntegral<T> ) { return Element &= InValue; }
FORCEINLINE ValueType operator&=(ValueType InValue) volatile requires CIntegral<T> && bIsAlwaysLockFree { return Element &= InValue; } FORCEINLINE ValueType operator&=(ValueType InValue) volatile requires (CIntegral<T> && bIsAlwaysLockFree) { return Element &= InValue; }
FORCEINLINE ValueType operator|=(ValueType InValue) requires CIntegral<T> { return Element |= InValue; } FORCEINLINE ValueType operator|=(ValueType InValue) requires (CIntegral<T> ) { return Element |= InValue; }
FORCEINLINE ValueType operator|=(ValueType InValue) volatile requires CIntegral<T> && bIsAlwaysLockFree { return Element |= InValue; } FORCEINLINE ValueType operator|=(ValueType InValue) volatile requires (CIntegral<T> && bIsAlwaysLockFree) { return Element |= InValue; }
FORCEINLINE ValueType operator^=(ValueType InValue) requires CIntegral<T> { return Element ^= InValue; } FORCEINLINE ValueType operator^=(ValueType InValue) requires (CIntegral<T> ) { return Element ^= InValue; }
FORCEINLINE ValueType operator^=(ValueType InValue) volatile requires CIntegral<T> && bIsAlwaysLockFree { return Element ^= InValue; } FORCEINLINE ValueType operator^=(ValueType InValue) volatile requires (CIntegral<T> && bIsAlwaysLockFree) { return Element ^= InValue; }
FORCEINLINE ValueType operator<<=(size_t InValue) requires CIntegral<T> { return FetchLsh(InValue) << InValue; } FORCEINLINE ValueType operator<<=(size_t InValue) requires (CIntegral<T> ) { return FetchLsh(InValue) << InValue; }
FORCEINLINE ValueType operator<<=(size_t InValue) volatile requires CIntegral<T> && bIsAlwaysLockFree { return FetchLsh(InValue) << InValue; } FORCEINLINE ValueType operator<<=(size_t InValue) volatile requires (CIntegral<T> && bIsAlwaysLockFree) { return FetchLsh(InValue) << InValue; }
FORCEINLINE ValueType operator>>=(size_t InValue) requires CIntegral<T> { return FetchRsh(InValue) >> InValue; } FORCEINLINE ValueType operator>>=(size_t InValue) requires (CIntegral<T> ) { return FetchRsh(InValue) >> InValue; }
FORCEINLINE ValueType operator>>=(size_t InValue) volatile requires CIntegral<T> && bIsAlwaysLockFree { return FetchRsh(InValue) >> InValue; } FORCEINLINE ValueType operator>>=(size_t InValue) volatile requires (CIntegral<T> && bIsAlwaysLockFree) { return FetchRsh(InValue) >> InValue; }
protected: protected:

View File

@ -6,7 +6,7 @@ NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility) NAMESPACE_MODULE_BEGIN(Utility)
template <typename T> requires requires(T&& Container) { Container.GetData(); } template <typename T> requires (requires(T&& Container) { Container.GetData(); })
constexpr decltype(auto) GetData(T&& Container) constexpr decltype(auto) GetData(T&& Container)
{ {
return Container.GetData(); return Container.GetData();
@ -17,13 +17,13 @@ template <typename T, size_t N> constexpr T* GetData( T(&& Container)
template <typename T, size_t N> constexpr const T* GetData(const T(& Container)[N]) { return Container; } template <typename T, size_t N> constexpr const T* GetData(const T(& Container)[N]) { return Container; }
template <typename T, size_t N> constexpr const T* GetData(const T(&& Container)[N]) { return Container; } template <typename T, size_t N> constexpr const T* GetData(const T(&& Container)[N]) { return Container; }
template <typename T> requires requires(T&& Container) { Container.data(); } template <typename T> requires (requires(T&& Container) { Container.data(); })
constexpr decltype(auto) GetData(T&& Container) constexpr decltype(auto) GetData(T&& Container)
{ {
return Container.data(); return Container.data();
} }
template <typename T> requires requires(T&& Container) { Container.Num(); } template <typename T> requires (requires(T&& Container) { Container.Num(); })
constexpr decltype(auto) GetNum(T&& Container) constexpr decltype(auto) GetNum(T&& Container)
{ {
return Container.Num(); return Container.Num();
@ -34,7 +34,7 @@ template <typename T, size_t N> constexpr size_t GetNum( T(&& Container)[N]
template <typename T, size_t N> constexpr size_t GetNum(const T(& Container)[N]) { return N; } template <typename T, size_t N> constexpr size_t GetNum(const T(& Container)[N]) { return N; }
template <typename T, size_t N> constexpr size_t GetNum(const T(&& Container)[N]) { return N; } template <typename T, size_t N> constexpr size_t GetNum(const T(&& Container)[N]) { return N; }
template <typename T> requires requires(T&& Container) { Container.size(); } template <typename T> requires (requires(T&& Container) { Container.size(); })
constexpr decltype(auto) GetNum(T&& Container) constexpr decltype(auto) GetNum(T&& Container)
{ {
return Container.size(); return Container.size();

View File

@ -109,10 +109,10 @@ public:
FORCEINLINE const type_info& TargetType() const requires (!bIsRef) { return IsValid() ? Storage.GetTypeInfo() : typeid(void); }; FORCEINLINE const type_info& TargetType() const requires (!bIsRef) { return IsValid() ? Storage.GetTypeInfo() : typeid(void); };
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 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>(); }
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) constexpr void Swap(TFunctionImpl& InValue) requires (!bIsRef)
{ {
@ -207,7 +207,7 @@ private:
else return GetCallableImpl()(&Storage, Forward<Ts>(Args)...); else return GetCallableImpl()(&Storage, Forward<Ts>(Args)...);
} }
protected: // These functions should not be used by user-defined class. protected: // These functions should not be used by user-defined class
template <typename DecayedType, typename... ArgTypes> template <typename DecayedType, typename... ArgTypes>
FORCEINLINE void EmplaceImpl(ArgTypes&&... Args) FORCEINLINE void EmplaceImpl(ArgTypes&&... Args)
@ -281,8 +281,8 @@ public:
TFunctionRef& operator=(const TFunctionRef& InValue) = delete; TFunctionRef& operator=(const TFunctionRef& InValue) = delete;
TFunctionRef& operator=(TFunctionRef&& InValue) = delete; TFunctionRef& operator=(TFunctionRef&& InValue) = delete;
template <typename T> requires (!CTFunctionRef<TDecay<T>>) && (!CTInPlaceType<TDecay<T>>) template <typename T> requires (!CTFunctionRef<TDecay<T>> && !CTInPlaceType<TDecay<T>>
&& NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value && NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value)
FORCEINLINE TFunctionRef(T&& InValue) FORCEINLINE TFunctionRef(T&& InValue)
{ {
using DecayedType = TDecay<T>; using DecayedType = TDecay<T>;
@ -329,10 +329,10 @@ public:
return *this; return *this;
} }
template <typename T> requires (!CTInPlaceType<TDecay<T>>) template <typename T> requires (!CTInPlaceType<TDecay<T>>
&& (!CTFunctionRef<TDecay<T>>) && (!CTFunction<TDecay<T>>) && (!CTUniqueFunction<TDecay<T>>) && !CTFunctionRef<TDecay<T>> && !CTFunction<TDecay<T>> && !CTUniqueFunction<TDecay<T>>
&& CConstructibleFrom<TDecay<T>, T&&> && CCopyConstructible<TDecay<T>> && CConstructibleFrom<TDecay<T>, T&&> && CCopyConstructible<TDecay<T>>
&& NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value && NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value)
FORCEINLINE TFunction(T&& InValue) FORCEINLINE TFunction(T&& InValue)
{ {
using DecayedType = TDecay<T>; using DecayedType = TDecay<T>;
@ -340,8 +340,8 @@ public:
else Impl::template EmplaceImpl<DecayedType>(Forward<T>(InValue)); else Impl::template EmplaceImpl<DecayedType>(Forward<T>(InValue));
} }
template <typename T, typename... ArgTypes> requires NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value template <typename T, typename... ArgTypes> requires (NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value
&& CConstructibleFrom<TDecay<T>, ArgTypes...> && CCopyConstructible<TDecay<T>> && CConstructibleFrom<TDecay<T>, ArgTypes...> && CCopyConstructible<TDecay<T>>)
FORCEINLINE TFunction(TInPlaceType<T>, ArgTypes&&... Args) FORCEINLINE TFunction(TInPlaceType<T>, ArgTypes&&... Args)
{ {
using DecayedType = TDecay<T>; using DecayedType = TDecay<T>;
@ -350,9 +350,9 @@ public:
constexpr TFunction& operator=(nullptr_t) { Impl::ResetImpl(); return *this; } constexpr TFunction& operator=(nullptr_t) { Impl::ResetImpl(); return *this; }
template <typename T> requires NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value template <typename T> requires (NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value
&& (!CTFunctionRef<TDecay<T>>) && (!CTFunction<TDecay<T>>) && (!CTUniqueFunction<TDecay<T>>) && !CTFunctionRef<TDecay<T>> && !CTFunction<TDecay<T>> && !CTUniqueFunction<TDecay<T>>
&& CConstructibleFrom<TDecay<T>, T&&> && CCopyConstructible<TDecay<T>> && CConstructibleFrom<TDecay<T>, T&&> && CCopyConstructible<TDecay<T>>)
FORCEINLINE TFunction& operator=(T&& InValue) FORCEINLINE TFunction& operator=(T&& InValue)
{ {
using DecayedType = TDecay<T>; using DecayedType = TDecay<T>;
@ -363,8 +363,8 @@ public:
return *this; return *this;
} }
template <typename T, typename... ArgTypes> requires NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value template <typename T, typename... ArgTypes> requires (NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value
&& CConstructibleFrom<TDecay<T>, ArgTypes...>&& CCopyConstructible<TDecay<T>> && CConstructibleFrom<TDecay<T>, ArgTypes...> && CCopyConstructible<TDecay<T>>)
FORCEINLINE TDecay<T>& Emplace(ArgTypes&&... Args) FORCEINLINE TDecay<T>& Emplace(ArgTypes&&... Args)
{ {
using DecayedType = TDecay<T>; using DecayedType = TDecay<T>;
@ -427,10 +427,10 @@ public:
return *this; return *this;
} }
template <typename T> requires (!CTInPlaceType<TDecay<T>>) template <typename T> requires (!CTInPlaceType<TDecay<T>>
&& (!CTFunctionRef<TDecay<T>>) && (!CTFunction<TDecay<T>>) && (!CTUniqueFunction<TDecay<T>>) && !CTFunctionRef<TDecay<T>> && !CTFunction<TDecay<T>> && !CTUniqueFunction<TDecay<T>>
&& CConstructibleFrom<TDecay<T>, T&&> && CMoveConstructible<TDecay<T>> && CConstructibleFrom<TDecay<T>, T&&> && CMoveConstructible<TDecay<T>>
&& NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value && NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value)
FORCEINLINE TUniqueFunction(T&& InValue) FORCEINLINE TUniqueFunction(T&& InValue)
{ {
using DecayedType = TDecay<T>; using DecayedType = TDecay<T>;
@ -438,8 +438,8 @@ public:
else Impl::template EmplaceImpl<DecayedType>(Forward<T>(InValue)); else Impl::template EmplaceImpl<DecayedType>(Forward<T>(InValue));
} }
template <typename T, typename... ArgTypes> requires NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value template <typename T, typename... ArgTypes> requires (NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value
&& CConstructibleFrom<TDecay<T>, ArgTypes...> && CMoveConstructible<TDecay<T>> && CConstructibleFrom<TDecay<T>, ArgTypes...> && CMoveConstructible<TDecay<T>>)
FORCEINLINE TUniqueFunction(TInPlaceType<T>, ArgTypes&&... Args) FORCEINLINE TUniqueFunction(TInPlaceType<T>, ArgTypes&&... Args)
{ {
using DecayedType = TDecay<T>; using DecayedType = TDecay<T>;
@ -448,9 +448,9 @@ public:
constexpr TUniqueFunction& operator=(nullptr_t) { Impl::ResetImpl(); return *this; } constexpr TUniqueFunction& operator=(nullptr_t) { Impl::ResetImpl(); return *this; }
template <typename T> requires NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value template <typename T> requires (NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value
&& (!CTFunctionRef<TDecay<T>>) && (!CTFunction<TDecay<T>>) && (!CTUniqueFunction<TDecay<T>>) && !CTFunctionRef<TDecay<T>> && !CTFunction<TDecay<T>> && !CTUniqueFunction<TDecay<T>>
&& CConstructibleFrom<TDecay<T>, T&&>&& CMoveConstructible<TDecay<T>> && CConstructibleFrom<TDecay<T>, T&&> && CMoveConstructible<TDecay<T>>)
FORCEINLINE TUniqueFunction& operator=(T&& InValue) FORCEINLINE TUniqueFunction& operator=(T&& InValue)
{ {
using DecayedType = TDecay<T>; using DecayedType = TDecay<T>;
@ -461,8 +461,8 @@ public:
return *this; return *this;
} }
template <typename T, typename... ArgTypes> requires NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value template <typename T, typename... ArgTypes> requires (NAMESPACE_PRIVATE::TIsInvocableSignature<F, TDecay<T>>::Value
&& CConstructibleFrom<TDecay<T>, ArgTypes...>&& CMoveConstructible<TDecay<T>> && CConstructibleFrom<TDecay<T>, ArgTypes...> && CMoveConstructible<TDecay<T>>)
FORCEINLINE TDecay<T>& Emplace(ArgTypes&&... Args) FORCEINLINE TDecay<T>& Emplace(ArgTypes&&... Args)
{ {
using DecayedType = TDecay<T>; using DecayedType = TDecay<T>;
@ -508,28 +508,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... Ts> requires CInvocable<F&, Ts&&...> template <typename... Ts> requires (CInvocable<F&, Ts&&...>)
constexpr auto operator()(Ts&&... Args) & constexpr auto operator()(Ts&&... Args) &
-> decltype(!Invoke(Storage, Forward<Ts>(Args)...)) -> decltype(!Invoke(Storage, Forward<Ts>(Args)...))
{ {
return !Invoke(Storage, Forward<Ts>(Args)...); return !Invoke(Storage, Forward<Ts>(Args)...);
} }
template <typename... Ts> requires CInvocable<F&&, Ts&&...> template <typename... Ts> requires (CInvocable<F&&, Ts&&...>)
constexpr auto operator()(Ts&&... Args) && constexpr auto operator()(Ts&&... Args) &&
-> decltype(!Invoke(MoveTemp(Storage), Forward<Ts>(Args)...)) -> decltype(!Invoke(MoveTemp(Storage), Forward<Ts>(Args)...))
{ {
return !Invoke(MoveTemp(Storage), Forward<Ts>(Args)...); return !Invoke(MoveTemp(Storage), Forward<Ts>(Args)...);
} }
template <typename... Ts> requires CInvocable<const F&, Ts&&...> template <typename... Ts> requires (CInvocable<const F&, Ts&&...>)
constexpr auto operator()(Ts&&... Args) const& constexpr auto operator()(Ts&&... Args) const&
-> decltype(!Invoke(Storage, Forward<Ts>(Args)...)) -> decltype(!Invoke(Storage, Forward<Ts>(Args)...))
{ {
return !Invoke(Storage, Forward<Ts>(Args)...); return !Invoke(Storage, Forward<Ts>(Args)...);
} }
template <typename... Ts> requires CInvocable<const F&&, Ts&&...> template <typename... Ts> requires (CInvocable<const F&&, Ts&&...>)
constexpr auto operator()(Ts&&... Args) const&& constexpr auto operator()(Ts&&... Args) const&&
-> decltype(!Invoke(MoveTemp(Storage), Forward<Ts>(Args)...)) -> decltype(!Invoke(MoveTemp(Storage), Forward<Ts>(Args)...))
{ {
@ -539,7 +539,7 @@ struct TNotFunction
NAMESPACE_PRIVATE_END NAMESPACE_PRIVATE_END
template <typename F> template <typename F> requires (CConstructibleFrom<F, F&&>)
constexpr NAMESPACE_PRIVATE::TNotFunction<TDecay<F>> NotFn(F&& Func) constexpr NAMESPACE_PRIVATE::TNotFunction<TDecay<F>> NotFn(F&& Func)
{ {
return NAMESPACE_PRIVATE::TNotFunction<TDecay<F>>(Forward<F>(Func)); return NAMESPACE_PRIVATE::TNotFunction<TDecay<F>>(Forward<F>(Func));

View File

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

View File

@ -11,7 +11,7 @@ NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility) NAMESPACE_MODULE_BEGIN(Utility)
template <typename OptionalType> requires CDestructible<OptionalType> template <typename OptionalType> requires (CDestructible<OptionalType>)
class TOptional class TOptional
{ {
private: private:
@ -40,39 +40,39 @@ public:
constexpr TOptional(FInvalid) : TOptional() { } constexpr TOptional(FInvalid) : TOptional() { }
template <typename... Ts> requires CConstructibleFrom<OptionalType, Ts...> template <typename... Ts> requires (CConstructibleFrom<OptionalType, Ts...>)
constexpr explicit TOptional(FInPlace, Ts&&... Args) constexpr explicit TOptional(FInPlace, Ts&&... Args)
: bIsValid(true) : bIsValid(true)
{ {
new(&Value) OptionalType(Forward<Ts>(Args)...); new(&Value) OptionalType(Forward<Ts>(Args)...);
} }
template <typename T = OptionalType> requires CConstructibleFrom<OptionalType, T&&> template <typename T = OptionalType> requires (CConstructibleFrom<OptionalType, T&&>)
&& (!CSameAs<TRemoveCVRef<T>, FInPlace>) && (!CSameAs<TRemoveCVRef<T>, TOptional>) && (!CSameAs<TRemoveCVRef<T>, FInPlace>) && (!CSameAs<TRemoveCVRef<T>, TOptional>)
constexpr explicit (!CConvertibleTo<T&&, OptionalType>) TOptional(T&& InValue) constexpr explicit (!CConvertibleTo<T&&, OptionalType>) TOptional(T&& InValue)
: TOptional(InPlace, Forward<T>(InValue)) : TOptional(InPlace, Forward<T>(InValue))
{ } { }
constexpr TOptional(const TOptional& InValue) requires CCopyConstructible<OptionalType> constexpr TOptional(const TOptional& InValue) requires (CCopyConstructible<OptionalType>)
: bIsValid(InValue.IsValid()) : bIsValid(InValue.IsValid())
{ {
if (InValue.IsValid()) new(&Value) OptionalType(InValue.GetValue()); if (InValue.IsValid()) new(&Value) OptionalType(InValue.GetValue());
} }
constexpr TOptional(TOptional&& InValue) requires CMoveConstructible<OptionalType> constexpr TOptional(TOptional&& InValue) requires (CMoveConstructible<OptionalType>)
: bIsValid(InValue.IsValid()) : bIsValid(InValue.IsValid())
{ {
if (InValue.IsValid()) new(&Value) OptionalType(MoveTemp(InValue.GetValue())); if (InValue.IsValid()) new(&Value) OptionalType(MoveTemp(InValue.GetValue()));
} }
template <typename T = OptionalType> requires CConstructibleFrom<OptionalType, const T&> && TAllowUnwrapping<T>::Value template <typename T = OptionalType> requires (CConstructibleFrom<OptionalType, const T&> && TAllowUnwrapping<T>::Value)
constexpr explicit (!CConvertibleTo<const T&, OptionalType>) 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 CConstructibleFrom<OptionalType, T&&> && TAllowUnwrapping<T>::Value template <typename T = OptionalType> requires (CConstructibleFrom<OptionalType, T&&> && TAllowUnwrapping<T>::Value)
constexpr explicit (!CConvertibleTo<T&&, OptionalType>) TOptional(TOptional<T>&& InValue) constexpr explicit (!CConvertibleTo<T&&, OptionalType>) TOptional(TOptional<T>&& InValue)
: bIsValid(InValue.IsValid()) : bIsValid(InValue.IsValid())
{ {
@ -84,7 +84,7 @@ public:
if constexpr (!CTriviallyDestructible<OptionalType>) Reset(); if constexpr (!CTriviallyDestructible<OptionalType>) Reset();
} }
constexpr TOptional& operator=(const TOptional& InValue) requires CCopyConstructible<OptionalType> && CCopyAssignable<OptionalType> constexpr TOptional& operator=(const TOptional& InValue) requires (CCopyConstructible<OptionalType> && CCopyAssignable<OptionalType>)
{ {
if (&InValue == this) return *this; if (&InValue == this) return *this;
@ -104,7 +104,7 @@ public:
return *this; return *this;
} }
constexpr TOptional& operator=(TOptional&& InValue) requires CMoveConstructible<OptionalType> && CMoveAssignable<OptionalType> constexpr TOptional& operator=(TOptional&& InValue) requires (CMoveConstructible<OptionalType> && CMoveAssignable<OptionalType>)
{ {
if (&InValue == this) return *this; if (&InValue == this) return *this;
@ -124,8 +124,8 @@ public:
return *this; return *this;
} }
template <typename T = OptionalType> requires CConstructibleFrom<OptionalType, const T&> template <typename T = OptionalType> requires (CConstructibleFrom<OptionalType, const T&>
&& CAssignableFrom<OptionalType&, const T&> && TAllowUnwrapping<T>::Value && CAssignableFrom<OptionalType&, const T&> && TAllowUnwrapping<T>::Value)
constexpr TOptional& operator=(const TOptional<T>& InValue) constexpr TOptional& operator=(const TOptional<T>& InValue)
{ {
if (!InValue.IsValid()) if (!InValue.IsValid())
@ -144,8 +144,8 @@ public:
return *this; return *this;
} }
template <typename T = OptionalType> requires CConstructibleFrom<OptionalType, T&&> template <typename T = OptionalType> requires (CConstructibleFrom<OptionalType, T&&>
&& CAssignableFrom<OptionalType&, T&&> && TAllowUnwrapping<T>::Value && CAssignableFrom<OptionalType&, T&&> && TAllowUnwrapping<T>::Value)
constexpr TOptional& operator=(TOptional<T>&& InValue) constexpr TOptional& operator=(TOptional<T>&& InValue)
{ {
if (!InValue.IsValid()) if (!InValue.IsValid())
@ -164,7 +164,7 @@ public:
return *this; return *this;
} }
template <typename T = OptionalType> requires CConstructibleFrom<OptionalType, T&&> && CAssignableFrom<OptionalType&, T&&> template <typename T = OptionalType> requires (CConstructibleFrom<OptionalType, T&&> && CAssignableFrom<OptionalType&, T&&>)
constexpr TOptional& operator=(T&& InValue) constexpr TOptional& operator=(T&& InValue)
{ {
if (IsValid()) GetValue() = Forward<T>(InValue); if (IsValid()) GetValue() = Forward<T>(InValue);
@ -177,7 +177,7 @@ public:
return *this; return *this;
} }
template <typename... ArgTypes> requires CConstructibleFrom<OptionalType, ArgTypes...> template <typename... ArgTypes> requires (CConstructibleFrom<OptionalType, ArgTypes...>)
constexpr OptionalType& Emplace(ArgTypes&&... Args) constexpr OptionalType& Emplace(ArgTypes&&... Args)
{ {
Reset(); Reset();
@ -218,13 +218,13 @@ public:
} }
} }
constexpr size_t GetTypeHash() const requires CHashable<OptionalType> constexpr size_t GetTypeHash() const requires (CHashable<OptionalType>)
{ {
if (!IsValid()) return 2824517378; if (!IsValid()) return 2824517378;
return NAMESPACE_REDCRAFT::GetTypeHash(GetValue()); return NAMESPACE_REDCRAFT::GetTypeHash(GetValue());
} }
template <typename T> requires CMoveConstructible<OptionalType> && CSwappable<OptionalType> template <typename T> requires (CMoveConstructible<OptionalType> && CSwappable<OptionalType>)
constexpr void Swap(TOptional& InValue) constexpr void Swap(TOptional& InValue)
{ {
if (!IsValid() && !InValue.IsValid()) return; if (!IsValid() && !InValue.IsValid()) return;
@ -256,7 +256,7 @@ private:
template <typename T> template <typename T>
TOptional(T) -> TOptional<T>; TOptional(T) -> TOptional<T>;
template <typename T, typename U> requires CWeaklyEqualityComparable<T, U> template <typename T, typename U> requires (CWeaklyEqualityComparable<T, U>)
constexpr bool operator==(const TOptional<T>& LHS, const TOptional<U>& RHS) constexpr bool operator==(const TOptional<T>& LHS, const TOptional<U>& RHS)
{ {
if (LHS.IsValid() != RHS.IsValid()) return false; if (LHS.IsValid() != RHS.IsValid()) return false;
@ -264,7 +264,7 @@ constexpr bool operator==(const TOptional<T>& LHS, const TOptional<U>& RHS)
return *LHS == *RHS; return *LHS == *RHS;
} }
template <typename T, typename U> requires CSynthThreeWayComparable<T, U> template <typename T, typename U> requires (CSynthThreeWayComparable<T, U>)
constexpr partial_ordering operator<=>(const TOptional<T>& LHS, const TOptional<U>& RHS) constexpr partial_ordering operator<=>(const TOptional<T>& LHS, const TOptional<U>& RHS)
{ {
if (LHS.IsValid() != RHS.IsValid()) return partial_ordering::unordered; if (LHS.IsValid() != RHS.IsValid()) return partial_ordering::unordered;
@ -272,7 +272,7 @@ constexpr partial_ordering operator<=>(const TOptional<T>& LHS, const TOptional<
return SynthThreeWayCompare(*LHS, *RHS); return SynthThreeWayCompare(*LHS, *RHS);
} }
template <typename T, typename U> requires CWeaklyEqualityComparable<T, U> template <typename T, typename U> requires (CWeaklyEqualityComparable<T, U>)
constexpr bool operator==(const TOptional<T>& LHS, const U& RHS) constexpr bool operator==(const TOptional<T>& LHS, const U& RHS)
{ {
return LHS.IsValid() ? *LHS == RHS : false; return LHS.IsValid() ? *LHS == RHS : false;
@ -284,19 +284,19 @@ constexpr bool operator==(const TOptional<T>& LHS, FInvalid)
return !LHS.IsValid(); return !LHS.IsValid();
} }
template <typename T> requires CDestructible<T> template <typename T> requires (CDestructible<T>)
constexpr TOptional<TDecay<T>> MakeOptional(FInvalid) constexpr TOptional<TDecay<T>> MakeOptional(FInvalid)
{ {
return TOptional<TDecay<T>>(Invalid); return TOptional<TDecay<T>>(Invalid);
} }
template <typename T> requires CDestructible<T> && CConstructibleFrom<T, T&&> template <typename T> requires (CDestructible<T> && CConstructibleFrom<T, T&&>)
constexpr TOptional<T> MakeOptional(T&& InValue) constexpr TOptional<T> MakeOptional(T&& InValue)
{ {
return TOptional<T>(Forward<T>(InValue)); return TOptional<T>(Forward<T>(InValue));
} }
template <typename T, typename... Ts> requires CDestructible<T> && CConstructibleFrom<T, Ts...> template <typename T, typename... Ts> requires (CDestructible<T> && CConstructibleFrom<T, Ts...>)
constexpr TOptional<T> MakeOptional(Ts&&... Args) constexpr TOptional<T> MakeOptional(Ts&&... Args)
{ {
return TOptional<T>(InPlace, Forward<T>(Args)...); return TOptional<T>(InPlace, Forward<T>(Args)...);

View File

@ -17,7 +17,7 @@ public:
using Type = ReferencedType; using Type = ReferencedType;
template <typename T = ReferencedType> requires CConvertibleTo<T, ReferencedType&> template <typename T = ReferencedType> requires (CConvertibleTo<T, ReferencedType&>)
constexpr TReferenceWrapper(T&& Object) constexpr TReferenceWrapper(T&& Object)
{ {
ReferencedType& Reference = Forward<T>(Object); ReferencedType& Reference = Forward<T>(Object);
@ -26,14 +26,14 @@ public:
TReferenceWrapper(const TReferenceWrapper&) = default; TReferenceWrapper(const TReferenceWrapper&) = default;
template <typename T = ReferencedType> requires CConvertibleTo<T&, ReferencedType&> 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 CConvertibleTo<T&, ReferencedType&> 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;
@ -49,7 +49,7 @@ public:
return Invoke(Get(), Forward<Ts>(Args)...); return Invoke(Get(), Forward<Ts>(Args)...);
} }
constexpr size_t GetTypeHash() const requires CHashable<ReferencedType> constexpr size_t GetTypeHash() const requires (CHashable<ReferencedType>)
{ {
return NAMESPACE_REDCRAFT::GetTypeHash(Get()); return NAMESPACE_REDCRAFT::GetTypeHash(Get());
} }
@ -69,7 +69,7 @@ private:
// Optimize TOptional with these hacking // Optimize TOptional with these hacking
constexpr TReferenceWrapper(FInvalid) : Pointer(nullptr) { }; constexpr TReferenceWrapper(FInvalid) : Pointer(nullptr) { };
template <typename T> requires CDestructible<T> friend class TOptional; template <typename T> requires (CDestructible<T>) friend class TOptional;
}; };
@ -155,13 +155,13 @@ public:
constexpr TOptional(FInvalid) : TOptional() { } constexpr TOptional(FInvalid) : TOptional() { }
template <typename... Ts> requires CConstructibleFrom<OptionalType, Ts...> template <typename... Ts> requires (CConstructibleFrom<OptionalType, Ts...>)
constexpr explicit TOptional(FInPlace, Ts&&... Args) constexpr explicit TOptional(FInPlace, Ts&&... Args)
: Reference(Forward<Ts>(Args)...) : Reference(Forward<Ts>(Args)...)
{ } { }
template <typename T = OptionalType> requires CConstructibleFrom<OptionalType, T&&> template <typename T = OptionalType> requires (CConstructibleFrom<OptionalType, T&&>
&& (!CSameAs<TRemoveCVRef<T>, FInPlace>) && (!CSameAs<TRemoveCVRef<T>, TOptional>) && !CSameAs<TRemoveCVRef<T>, FInPlace> && !CSameAs<TRemoveCVRef<T>, TOptional>)
constexpr explicit (!CConvertibleTo<T&&, OptionalType>) TOptional(T&& InValue) constexpr explicit (!CConvertibleTo<T&&, OptionalType>) TOptional(T&& InValue)
: TOptional(InPlace, Forward<T>(InValue)) : TOptional(InPlace, Forward<T>(InValue))
{ } { }
@ -169,7 +169,7 @@ public:
TOptional(const TOptional& InValue) = default; TOptional(const TOptional& InValue) = default;
TOptional(TOptional&& InValue) = default; TOptional(TOptional&& InValue) = default;
template <typename T = OptionalType> requires CConstructibleFrom<OptionalType, const T&> && TAllowUnwrapping<T>::Value template <typename T = OptionalType> requires (CConstructibleFrom<OptionalType, const T&> && TAllowUnwrapping<T>::Value)
constexpr explicit (!CConvertibleTo<const T&, OptionalType>) TOptional(const TOptional<T>& InValue) constexpr explicit (!CConvertibleTo<const T&, OptionalType>) TOptional(const TOptional<T>& InValue)
: Reference(InValue.Reference) : Reference(InValue.Reference)
{ } { }
@ -179,22 +179,22 @@ public:
TOptional& operator=(const TOptional& InValue) = default; TOptional& operator=(const TOptional& InValue) = default;
TOptional& operator=(TOptional&& InValue) = default; TOptional& operator=(TOptional&& InValue) = default;
template <typename T = OptionalType> requires CConstructibleFrom<OptionalType, const T&> template <typename T = OptionalType> requires (CConstructibleFrom<OptionalType, const T&>
&& CAssignableFrom<OptionalType&, const T&> && TAllowUnwrapping<T>::Value && CAssignableFrom<OptionalType&, const T&> && TAllowUnwrapping<T>::Value)
constexpr TOptional& operator=(const TOptional<T>& InValue) constexpr TOptional& operator=(const TOptional<T>& InValue)
{ {
Reference = InValue.Reference; Reference = InValue.Reference;
return *this; return *this;
} }
template <typename T = OptionalType> requires CConstructibleFrom<OptionalType, T&&> && CAssignableFrom<OptionalType&, T&&> template <typename T = OptionalType> requires (CConstructibleFrom<OptionalType, T&&> && CAssignableFrom<OptionalType&, T&&>)
constexpr TOptional& operator=(T&& InValue) constexpr TOptional& operator=(T&& InValue)
{ {
Reference = InValue; Reference = InValue;
return *this; return *this;
} }
template <typename... ArgTypes> requires CConstructibleFrom<OptionalType, ArgTypes...> template <typename... ArgTypes> requires (CConstructibleFrom<OptionalType, ArgTypes...>)
constexpr OptionalType& Emplace(ArgTypes&&... Args) constexpr OptionalType& Emplace(ArgTypes&&... Args)
{ {
Reference = TReferenceWrapper<ReferencedType>(Forward<ArgTypes>(Args)...); Reference = TReferenceWrapper<ReferencedType>(Forward<ArgTypes>(Args)...);
@ -225,7 +225,7 @@ public:
Reference = Invalid; Reference = Invalid;
} }
constexpr size_t GetTypeHash() const requires CHashable<ReferencedType> constexpr size_t GetTypeHash() const requires (CHashable<ReferencedType>)
{ {
if (!IsValid()) return 2824517378; if (!IsValid()) return 2824517378;
return Reference.GetTypeHash(); return Reference.GetTypeHash();
@ -239,7 +239,7 @@ public:
private: private:
TReferenceWrapper<ReferencedType> Reference; TReferenceWrapper<ReferencedType> Reference;
template <typename T> requires CDestructible<T> friend class TOptional; template <typename T> requires (CDestructible<T>) friend class TOptional;
}; };

View File

@ -312,22 +312,22 @@ public:
TTuple() = default; TTuple() = default;
template <typename... ArgTypes> requires (sizeof...(Ts) >= 1) && (sizeof...(ArgTypes) == sizeof...(Ts)) template <typename... ArgTypes> requires (sizeof...(Ts) >= 1 && sizeof...(ArgTypes) == sizeof...(Ts))
&& (true && ... && CConstructibleFrom<Ts, ArgTypes&&>) && (true && ... && CConstructibleFrom<Ts, ArgTypes&&>)
constexpr explicit (!(true && ... && CConvertibleTo<ArgTypes&&, Ts>)) TTuple(ArgTypes&&... Args) constexpr explicit (!(true && ... && CConvertibleTo<ArgTypes&&, Ts>)) TTuple(ArgTypes&&... Args)
: Super(NAMESPACE_PRIVATE::ForwardingConstructor, Forward<ArgTypes>(Args)...) : Super(NAMESPACE_PRIVATE::ForwardingConstructor, Forward<ArgTypes>(Args)...)
{ } { }
template <typename... OtherTypes> requires (sizeof...(OtherTypes) == sizeof...(Ts)) template <typename... OtherTypes> requires (sizeof...(OtherTypes) == sizeof...(Ts)
&& (true && ... && CConstructibleFrom<Ts, const OtherTypes&>) && (true && ... && CConstructibleFrom<Ts, const OtherTypes&>)
&& NAMESPACE_PRIVATE::TTupleConvertCopy<sizeof...(Ts) != 1, Ts..., OtherTypes...>::Value && NAMESPACE_PRIVATE::TTupleConvertCopy<sizeof...(Ts) != 1, Ts..., OtherTypes...>::Value)
constexpr explicit (!(true && ... && CConvertibleTo<OtherTypes&&, Ts>)) TTuple(const TTuple<OtherTypes...>& InValue) constexpr explicit (!(true && ... && CConvertibleTo<OtherTypes&&, Ts>)) TTuple(const TTuple<OtherTypes...>& InValue)
: Super(NAMESPACE_PRIVATE::OtherTupleConstructor, InValue) : Super(NAMESPACE_PRIVATE::OtherTupleConstructor, InValue)
{ } { }
template <typename... OtherTypes> requires (sizeof...(OtherTypes) == sizeof...(Ts)) template <typename... OtherTypes> requires (sizeof...(OtherTypes) == sizeof...(Ts)
&& (true && ... && CConstructibleFrom<Ts, OtherTypes&&>) && (true && ... && CConstructibleFrom<Ts, OtherTypes&&>)
&& NAMESPACE_PRIVATE::TTupleConvertMove<sizeof...(Ts) != 1, Ts..., OtherTypes...>::Value && NAMESPACE_PRIVATE::TTupleConvertMove<sizeof...(Ts) != 1, Ts..., OtherTypes...>::Value)
constexpr explicit (!(true && ... && CConvertibleTo<OtherTypes&&, Ts>)) TTuple(TTuple<OtherTypes...>&& InValue) constexpr explicit (!(true && ... && CConvertibleTo<OtherTypes&&, Ts>)) TTuple(TTuple<OtherTypes...>&& InValue)
: Super(NAMESPACE_PRIVATE::OtherTupleConstructor, MoveTemp(InValue)) : Super(NAMESPACE_PRIVATE::OtherTupleConstructor, MoveTemp(InValue))
{ } { }
@ -335,16 +335,16 @@ public:
TTuple(const TTuple&) = default; TTuple(const TTuple&) = default;
TTuple(TTuple&&) = default; TTuple(TTuple&&) = default;
template <typename... OtherTypes> requires (sizeof...(OtherTypes) == sizeof...(Ts)) template <typename... OtherTypes> requires (sizeof...(OtherTypes) == sizeof...(Ts)
&& (true && ... && CAssignableFrom<Ts&, const OtherTypes&>) && (true && ... && CAssignableFrom<Ts&, const OtherTypes&>))
constexpr TTuple& operator=(const TTuple<OtherTypes...>& InValue) constexpr TTuple& operator=(const TTuple<OtherTypes...>& InValue)
{ {
Helper::Assign(*this, InValue); Helper::Assign(*this, InValue);
return *this; return *this;
} }
template <typename... OtherTypes> requires (sizeof...(OtherTypes) == sizeof...(Ts)) template <typename... OtherTypes> requires (sizeof...(OtherTypes) == sizeof...(Ts)
&& (true && ... && CAssignableFrom<Ts&, OtherTypes&&>) && (true && ... && CAssignableFrom<Ts&, OtherTypes&&>))
constexpr TTuple& operator=(TTuple<OtherTypes...>&& InValue) constexpr TTuple& operator=(TTuple<OtherTypes...>&& InValue)
{ {
Helper::Assign(*this, MoveTemp(InValue)); Helper::Assign(*this, MoveTemp(InValue));
@ -372,32 +372,32 @@ public:
template <typename T> constexpr decltype(auto) GetValue() volatile&& { return static_cast< volatile TTuple&&>(*this).GetValue<TTupleIndex<T, TTuple<Ts...>>>(); } template <typename T> constexpr decltype(auto) GetValue() volatile&& { return static_cast< volatile TTuple&&>(*this).GetValue<TTupleIndex<T, TTuple<Ts...>>>(); }
template <typename T> constexpr decltype(auto) GetValue() const volatile&& { return static_cast<const volatile TTuple&&>(*this).GetValue<TTupleIndex<T, TTuple<Ts...>>>(); } template <typename T> constexpr decltype(auto) GetValue() const volatile&& { return static_cast<const volatile TTuple&&>(*this).GetValue<TTupleIndex<T, TTuple<Ts...>>>(); }
template <typename F> requires CInvocable<F, Ts...> constexpr decltype(auto) Apply(F&& Func) & { return Helper::Apply(Forward<F>(Func), static_cast< TTuple& >(*this)); } template <typename F> requires (CInvocable<F, Ts...>) constexpr decltype(auto) Apply(F&& Func) & { return Helper::Apply(Forward<F>(Func), static_cast< TTuple& >(*this)); }
template <typename F> requires CInvocable<F, Ts...> constexpr decltype(auto) Apply(F&& Func) const & { return Helper::Apply(Forward<F>(Func), static_cast<const TTuple& >(*this)); } template <typename F> requires (CInvocable<F, Ts...>) constexpr decltype(auto) Apply(F&& Func) const & { return Helper::Apply(Forward<F>(Func), static_cast<const TTuple& >(*this)); }
template <typename F> requires CInvocable<F, Ts...> constexpr decltype(auto) Apply(F&& Func) volatile& { return Helper::Apply(Forward<F>(Func), static_cast< volatile TTuple& >(*this)); } template <typename F> requires (CInvocable<F, Ts...>) constexpr decltype(auto) Apply(F&& Func) volatile& { return Helper::Apply(Forward<F>(Func), static_cast< volatile TTuple& >(*this)); }
template <typename F> requires CInvocable<F, Ts...> constexpr decltype(auto) Apply(F&& Func) const volatile& { return Helper::Apply(Forward<F>(Func), static_cast<const volatile TTuple& >(*this)); } template <typename F> requires (CInvocable<F, Ts...>) constexpr decltype(auto) Apply(F&& Func) const volatile& { return Helper::Apply(Forward<F>(Func), static_cast<const volatile TTuple& >(*this)); }
template <typename F> requires CInvocable<F, Ts...> constexpr decltype(auto) Apply(F&& Func) && { return Helper::Apply(Forward<F>(Func), static_cast< TTuple&&>(*this)); } template <typename F> requires (CInvocable<F, Ts...>) constexpr decltype(auto) Apply(F&& Func) && { return Helper::Apply(Forward<F>(Func), static_cast< TTuple&&>(*this)); }
template <typename F> requires CInvocable<F, Ts...> constexpr decltype(auto) Apply(F&& Func) const && { return Helper::Apply(Forward<F>(Func), static_cast<const TTuple&&>(*this)); } template <typename F> requires (CInvocable<F, Ts...>) constexpr decltype(auto) Apply(F&& Func) const && { return Helper::Apply(Forward<F>(Func), static_cast<const TTuple&&>(*this)); }
template <typename F> requires CInvocable<F, Ts...> constexpr decltype(auto) Apply(F&& Func) volatile&& { return Helper::Apply(Forward<F>(Func), static_cast< volatile TTuple&&>(*this)); } template <typename F> requires (CInvocable<F, Ts...>) constexpr decltype(auto) Apply(F&& Func) volatile&& { return Helper::Apply(Forward<F>(Func), static_cast< volatile TTuple&&>(*this)); }
template <typename F> requires CInvocable<F, Ts...> constexpr decltype(auto) Apply(F&& Func) const volatile&& { return Helper::Apply(Forward<F>(Func), static_cast<const volatile TTuple&&>(*this)); } template <typename F> requires (CInvocable<F, Ts...>) constexpr decltype(auto) Apply(F&& Func) const volatile&& { return Helper::Apply(Forward<F>(Func), static_cast<const volatile TTuple&&>(*this)); }
template <typename F, typename... ArgTypes> requires CInvocable<F, ArgTypes..., Ts...> constexpr decltype(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..., Ts...>) constexpr decltype(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..., Ts...> constexpr decltype(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..., Ts...>) constexpr decltype(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..., Ts...> constexpr decltype(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..., Ts...>) constexpr decltype(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..., Ts...> constexpr decltype(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..., Ts...>) constexpr decltype(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..., Ts...> constexpr decltype(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..., Ts...>) constexpr decltype(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..., Ts...> constexpr decltype(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..., Ts...>) constexpr decltype(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..., Ts...> constexpr decltype(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..., Ts...>) constexpr decltype(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..., Ts...> constexpr decltype(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..., Ts...>) constexpr decltype(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, Ts..., ArgTypes...> constexpr decltype(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, Ts..., ArgTypes...>) constexpr decltype(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, Ts..., ArgTypes...> constexpr decltype(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, Ts..., ArgTypes...>) constexpr decltype(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, Ts..., ArgTypes...> constexpr decltype(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, Ts..., ArgTypes...>) constexpr decltype(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, Ts..., ArgTypes...> constexpr decltype(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, Ts..., ArgTypes...>) constexpr decltype(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, Ts..., ArgTypes...> constexpr decltype(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, Ts..., ArgTypes...>) constexpr decltype(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, Ts..., ArgTypes...> constexpr decltype(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, Ts..., ArgTypes...>) constexpr decltype(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, Ts..., ArgTypes...> constexpr decltype(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, Ts..., ArgTypes...>) constexpr decltype(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, Ts..., ArgTypes...> constexpr decltype(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, Ts..., ArgTypes...>) constexpr decltype(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 && ... && (CInvocable<F, Ts> && !CSameAs<void, TInvokeResult<F, Ts>>)) constexpr decltype(auto) Transform(F&& Func) & { return Helper::Transform(Forward<F>(Func), static_cast< TTuple& >(*this)); } template <typename F> requires (true && ... && (CInvocable<F, Ts> && !CSameAs<void, TInvokeResult<F, Ts>>)) constexpr decltype(auto) Transform(F&& Func) & { return Helper::Transform(Forward<F>(Func), static_cast< TTuple& >(*this)); }
template <typename F> requires (true && ... && (CInvocable<F, Ts> && !CSameAs<void, TInvokeResult<F, Ts>>)) constexpr decltype(auto) Transform(F&& Func) const & { return Helper::Transform(Forward<F>(Func), static_cast<const TTuple& >(*this)); } template <typename F> requires (true && ... && (CInvocable<F, Ts> && !CSameAs<void, TInvokeResult<F, Ts>>)) constexpr decltype(auto) Transform(F&& Func) const & { return Helper::Transform(Forward<F>(Func), static_cast<const TTuple& >(*this)); }
@ -408,14 +408,14 @@ public:
template <typename F> requires (true && ... && (CInvocable<F, Ts> && !CSameAs<void, TInvokeResult<F, Ts>>)) constexpr decltype(auto) Transform(F&& Func) volatile&& { return Helper::Transform(Forward<F>(Func), static_cast< volatile TTuple&&>(*this)); } template <typename F> requires (true && ... && (CInvocable<F, Ts> && !CSameAs<void, TInvokeResult<F, Ts>>)) constexpr decltype(auto) Transform(F&& Func) volatile&& { return Helper::Transform(Forward<F>(Func), static_cast< volatile TTuple&&>(*this)); }
template <typename F> requires (true && ... && (CInvocable<F, Ts> && !CSameAs<void, TInvokeResult<F, Ts>>)) constexpr decltype(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, Ts> && !CSameAs<void, TInvokeResult<F, Ts>>)) constexpr decltype(auto) Transform(F&& Func) const volatile&& { return Helper::Transform(Forward<F>(Func), static_cast<const volatile TTuple&&>(*this)); }
template <typename T> requires CConstructibleFrom<T, Ts...> constexpr T Construct() & { return Helper::template Construct<T>(static_cast< TTuple& >(*this)); } template <typename T> requires (CConstructibleFrom<T, Ts...>) constexpr T Construct() & { return Helper::template Construct<T>(static_cast< TTuple& >(*this)); }
template <typename T> requires CConstructibleFrom<T, Ts...> constexpr T Construct() const & { return Helper::template Construct<T>(static_cast<const TTuple& >(*this)); } template <typename T> requires (CConstructibleFrom<T, Ts...>) constexpr T Construct() const & { return Helper::template Construct<T>(static_cast<const TTuple& >(*this)); }
template <typename T> requires CConstructibleFrom<T, Ts...> constexpr T Construct() volatile& { return Helper::template Construct<T>(static_cast< volatile TTuple& >(*this)); } template <typename T> requires (CConstructibleFrom<T, Ts...>) constexpr T Construct() volatile& { return Helper::template Construct<T>(static_cast< volatile TTuple& >(*this)); }
template <typename T> requires CConstructibleFrom<T, Ts...> constexpr T Construct() const volatile& { return Helper::template Construct<T>(static_cast<const volatile TTuple& >(*this)); } template <typename T> requires (CConstructibleFrom<T, Ts...>) constexpr T Construct() const volatile& { return Helper::template Construct<T>(static_cast<const volatile TTuple& >(*this)); }
template <typename T> requires CConstructibleFrom<T, Ts...> constexpr T Construct() && { return Helper::template Construct<T>(static_cast< TTuple&&>(*this)); } template <typename T> requires (CConstructibleFrom<T, Ts...>) constexpr T Construct() && { return Helper::template Construct<T>(static_cast< TTuple&&>(*this)); }
template <typename T> requires CConstructibleFrom<T, Ts...> constexpr T Construct() const && { return Helper::template Construct<T>(static_cast<const TTuple&&>(*this)); } template <typename T> requires (CConstructibleFrom<T, Ts...>) constexpr T Construct() const && { return Helper::template Construct<T>(static_cast<const TTuple&&>(*this)); }
template <typename T> requires CConstructibleFrom<T, Ts...> constexpr T Construct() volatile&& { return Helper::template Construct<T>(static_cast< volatile TTuple&&>(*this)); } template <typename T> requires (CConstructibleFrom<T, Ts...>) constexpr T Construct() volatile&& { return Helper::template Construct<T>(static_cast< volatile TTuple&&>(*this)); }
template <typename T> requires CConstructibleFrom<T, Ts...> constexpr T Construct() const volatile&& { return Helper::template Construct<T>(static_cast<const volatile TTuple&&>(*this)); } template <typename T> requires (CConstructibleFrom<T, Ts...>) constexpr T Construct() const volatile&& { return Helper::template Construct<T>(static_cast<const volatile TTuple&&>(*this)); }
constexpr size_t GetTypeHash() const requires (true && ... && CHashable<Ts>) constexpr size_t GetTypeHash() const requires (true && ... && CHashable<Ts>)
{ {
@ -593,21 +593,21 @@ constexpr decltype(auto) TupleCat(TTupleTypes&&... Args)
else return NAMESPACE_PRIVATE::TTupleCatImpl<R>::F(Forward<TTupleTypes>(Args)...); else return NAMESPACE_PRIVATE::TTupleCatImpl<R>::F(Forward<TTupleTypes>(Args)...);
} }
template <typename... LHSTypes, typename... RHSTypes> requires ((sizeof...(LHSTypes) != sizeof...(RHSTypes)) || (true && ... && CWeaklyEqualityComparable<LHSTypes, RHSTypes>)) template <typename... LHSTypes, typename... RHSTypes> requires (sizeof...(LHSTypes) != sizeof...(RHSTypes) || (true && ... && CWeaklyEqualityComparable<LHSTypes, RHSTypes>))
constexpr bool operator==(const TTuple<LHSTypes...>& LHS, const TTuple<RHSTypes...>& RHS) constexpr bool operator==(const TTuple<LHSTypes...>& LHS, const TTuple<RHSTypes...>& RHS)
{ {
if constexpr (sizeof...(LHSTypes) != sizeof...(RHSTypes)) return false; if constexpr (sizeof...(LHSTypes) != sizeof...(RHSTypes)) return false;
return[&LHS, &RHS]<size_t... Indices>(TIndexSequence<Indices...>) -> bool { return (true && ... && (LHS.template GetValue<Indices>() == RHS.template GetValue<Indices>())); } (TMakeIndexSequence<sizeof...(LHSTypes)>()); return[&LHS, &RHS]<size_t... Indices>(TIndexSequence<Indices...>) -> bool { return (true && ... && (LHS.template GetValue<Indices>() == RHS.template GetValue<Indices>())); } (TMakeIndexSequence<sizeof...(LHSTypes)>());
} }
template <typename... LHSTypes, typename... RHSTypes> requires ((sizeof...(LHSTypes) == sizeof...(RHSTypes)) && (true && ... && (CSynthThreeWayComparable<LHSTypes, RHSTypes>))) template <typename... LHSTypes, typename... RHSTypes> requires (sizeof...(LHSTypes) == sizeof...(RHSTypes) && (true && ... && (CSynthThreeWayComparable<LHSTypes, RHSTypes>)))
constexpr TCommonComparisonCategory<TSynthThreeWayResult<LHSTypes, RHSTypes>...> operator<=>(const TTuple<LHSTypes...>& LHS, const TTuple<RHSTypes...>& RHS) constexpr TCommonComparisonCategory<TSynthThreeWayResult<LHSTypes, RHSTypes>...> operator<=>(const TTuple<LHSTypes...>& LHS, const TTuple<RHSTypes...>& RHS)
{ {
using R = TCommonComparisonCategory<TSynthThreeWayResult<LHSTypes, RHSTypes>...>; using R = TCommonComparisonCategory<TSynthThreeWayResult<LHSTypes, RHSTypes>...>;
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 CInvocable<F> 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>
@ -617,14 +617,14 @@ constexpr void VisitTuple(F&& Func, FirstTupleType&& FirstTuple, TupleTypes&&...
::F(Forward<F>(Func), Forward<FirstTupleType>(FirstTuple), Forward<TupleTypes>(Tuples)...); ::F(Forward<F>(Func), Forward<FirstTupleType>(FirstTuple), Forward<TupleTypes>(Tuples)...);
} }
template <typename... Ts, typename... Us> requires requires { typename TTuple<TCommonType<Ts, Us>...>; } template <typename... Ts, typename... Us> requires (requires { typename TTuple<TCommonType<Ts, Us>...>; })
struct TBasicCommonType<TTuple<Ts...>, TTuple<Us...>> struct TBasicCommonType<TTuple<Ts...>, TTuple<Us...>>
{ {
using Type = TTuple<TCommonType<Ts, Us>...>; using Type = TTuple<TCommonType<Ts, Us>...>;
}; };
template <typename... Ts, typename... Us, template<typename> typename TQualifiers, template<typename> typename UQualifiers> template <typename... Ts, typename... Us, template<typename> typename TQualifiers, template<typename> typename UQualifiers>
requires requires { typename TTuple<TCommonReference<TQualifiers<Ts>, UQualifiers<Us>>...>; } requires (requires { typename TTuple<TCommonReference<TQualifiers<Ts>, UQualifiers<Us>>...>; })
struct TBasicCommonReference<TTuple<Ts...>, TTuple<Us...>, TQualifiers, UQualifiers> struct TBasicCommonReference<TTuple<Ts...>, TTuple<Us...>, TQualifiers, UQualifiers>
{ {
using Type = TTuple<TCommonReference<TQualifiers<Ts>, UQualifiers<Us>>...>; using Type = TTuple<TCommonReference<TQualifiers<Ts>, UQualifiers<Us>>...>;

View File

@ -46,7 +46,7 @@ constexpr size_t HashCombine(size_t A, size_t C, Ts... InOther)
return HashCombine(B, InOther...); return HashCombine(B, InOther...);
} }
template <typename T> requires CIntegral<T> template <CIntegral T>
constexpr size_t GetTypeHash(T A) constexpr size_t GetTypeHash(T A)
{ {
static_assert(sizeof(T) <= 16, "GetTypeHash only works with T up to 128 bits."); static_assert(sizeof(T) <= 16, "GetTypeHash only works with T up to 128 bits.");
@ -59,7 +59,7 @@ constexpr size_t GetTypeHash(T A)
return INDEX_NONE; return INDEX_NONE;
} }
template <typename T> requires CFloatingPoint<T> template <CFloatingPoint T>
constexpr size_t GetTypeHash(T A) constexpr size_t GetTypeHash(T A)
{ {
static_assert(sizeof(T) <= 16, "GetTypeHash only works with T up to 128 bits."); static_assert(sizeof(T) <= 16, "GetTypeHash only works with T up to 128 bits.");
@ -74,25 +74,25 @@ constexpr size_t GetTypeHash(T A)
return INDEX_NONE; return INDEX_NONE;
} }
template <typename T> requires CEnum<T> template <CEnum T>
constexpr size_t GetTypeHash(T A) constexpr size_t GetTypeHash(T A)
{ {
return GetTypeHash(static_cast<TUnderlyingType<T>>(A)); return GetTypeHash(static_cast<TUnderlyingType<T>>(A));
} }
template <typename T> requires CPointer<T> || CSameAs<T, nullptr_t> 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));
} }
template <typename T> requires requires(const T& A) { { GetTypeHash(A.GetTypeHash()) } -> CSameAs<size_t>; } template <typename T> requires (requires(const T& A) { { GetTypeHash(A.GetTypeHash()) } -> CSameAs<size_t>; })
constexpr size_t GetTypeHash(const T& A) constexpr size_t GetTypeHash(const T& A)
{ {
return GetTypeHash(A.GetTypeHash()); return GetTypeHash(A.GetTypeHash());
} }
template <typename T> requires requires(const T& A) { { GetTypeHash(A.hash_code()) } -> CSameAs<size_t>; } template <typename T> requires (requires(const T& A) { { GetTypeHash(A.hash_code()) } -> CSameAs<size_t>; })
constexpr size_t GetTypeHash(const T& A) constexpr size_t GetTypeHash(const T& A)
{ {
return GetTypeHash(A.hash_code()); return GetTypeHash(A.hash_code());

View File

@ -55,8 +55,8 @@ constexpr T&& Forward(TRemoveReference<T>&& Obj)
return static_cast<T&&>(Obj); return static_cast<T&&>(Obj);
} }
template <typename T> requires requires(T& A, T& B) { A.Swap(B); } template <typename T> requires (requires(T& A, T& B) { A.Swap(B); }
|| (CMoveConstructible<T> && CMoveAssignable<T>) || (CMoveConstructible<T> && CMoveAssignable<T>))
constexpr void Swap(T& A, T& B) constexpr void Swap(T& A, T& B)
{ {
if constexpr (requires(T& A, T& B) { A.Swap(B); }) if constexpr (requires(T& A, T& B) { A.Swap(B); })
@ -71,7 +71,7 @@ constexpr void Swap(T& A, T& B)
} }
} }
template <typename T, typename U = T> requires CMoveConstructible<T> && CAssignableFrom<T&, U> template <typename T, typename U = T> requires (CMoveConstructible<T> && CAssignableFrom<T&, U>)
constexpr T Exchange(T& A, U&& B) constexpr T Exchange(T& A, U&& B)
{ {
T Temp = MoveTemp(A); T Temp = MoveTemp(A);
@ -82,7 +82,7 @@ constexpr T Exchange(T& A, U&& B)
template <typename T> template <typename T>
constexpr T&& DeclVal(); constexpr T&& DeclVal();
template <typename T> requires CObject<T> template <typename T> requires (CObject<T>)
constexpr T* AddressOf(T& Object) constexpr T* AddressOf(T& Object)
{ {
return reinterpret_cast<T*>(&const_cast<char&>(reinterpret_cast<const volatile char&>(Object))); return reinterpret_cast<T*>(&const_cast<char&>(reinterpret_cast<const volatile char&>(Object)));

View File

@ -159,8 +159,8 @@ public:
if (IsValid()) MoveConstructImpl[InValue.GetIndex()](&Value, &InValue.Value); if (IsValid()) MoveConstructImpl[InValue.GetIndex()](&Value, &InValue.Value);
} }
template <size_t I, typename... ArgTypes> requires (I < sizeof...(Ts)) template <size_t I, typename... ArgTypes> requires (I < sizeof...(Ts)
&& CConstructibleFrom<TVariantAlternative<I, TVariant<Ts...>>, ArgTypes...> && CConstructibleFrom<TVariantAlternative<I, TVariant<Ts...>>, ArgTypes...>)
constexpr explicit TVariant(TInPlaceIndex<I>, ArgTypes&&... Args) constexpr explicit TVariant(TInPlaceIndex<I>, ArgTypes&&... Args)
: TypeIndex(I) : TypeIndex(I)
{ {
@ -168,14 +168,14 @@ public:
new(&Value) SelectedType(Forward<ArgTypes>(Args)...); new(&Value) SelectedType(Forward<ArgTypes>(Args)...);
} }
template <typename T, typename... ArgTypes> requires CConstructibleFrom<T, ArgTypes...> template <typename T, typename... ArgTypes> requires (CConstructibleFrom<T, ArgTypes...>)
constexpr explicit TVariant(TInPlaceType<T>, ArgTypes&&... Args) constexpr explicit TVariant(TInPlaceType<T>, ArgTypes&&... Args)
: TVariant(InPlaceIndex<TVariantIndex<T, TVariant<Ts...>>>, Forward<ArgTypes>(Args)...) : TVariant(InPlaceIndex<TVariantIndex<T, TVariant<Ts...>>>, Forward<ArgTypes>(Args)...)
{ } { }
template <typename T> requires NAMESPACE_PRIVATE::TVariantSelectedType<TRemoveReference<T>, Ts...>::Value template <typename T> requires (NAMESPACE_PRIVATE::TVariantSelectedType<TRemoveReference<T>, Ts...>::Value
&& (!CTInPlaceType<TRemoveCVRef<T>>) && (!CTInPlaceIndex<TRemoveCVRef<T>>) && !CTInPlaceType<TRemoveCVRef<T>> && !CTInPlaceIndex<TRemoveCVRef<T>>
&& (!CSameAs<TRemoveCVRef<T>, TVariant>) && !CSameAs<TRemoveCVRef<T>, TVariant>)
constexpr TVariant(T&& InValue) : TVariant(InPlaceType<typename NAMESPACE_PRIVATE::TVariantSelectedType<TRemoveReference<T>, Ts...>::Type>, Forward<T>(InValue)) constexpr TVariant(T&& InValue) : TVariant(InPlaceType<typename NAMESPACE_PRIVATE::TVariantSelectedType<TRemoveReference<T>, Ts...>::Type>, Forward<T>(InValue))
{ } { }
@ -226,7 +226,7 @@ public:
return *this; return *this;
} }
template <typename T> requires NAMESPACE_PRIVATE::TVariantSelectedType<TRemoveReference<T>, Ts...>::Value template <typename T> requires (NAMESPACE_PRIVATE::TVariantSelectedType<TRemoveReference<T>, Ts...>::Value)
constexpr TVariant& operator=(T&& InValue) constexpr TVariant& operator=(T&& InValue)
{ {
using SelectedType = typename NAMESPACE_PRIVATE::TVariantSelectedType<TRemoveReference<T>, Ts...>::Type; using SelectedType = typename NAMESPACE_PRIVATE::TVariantSelectedType<TRemoveReference<T>, Ts...>::Type;
@ -242,8 +242,8 @@ public:
return *this; return *this;
} }
template <size_t I, typename... ArgTypes> requires (I < sizeof...(Ts)) template <size_t I, typename... ArgTypes> requires (I < sizeof...(Ts)
&& CConstructibleFrom<TVariantAlternative<I, TVariant<Ts...>>, ArgTypes...> && CConstructibleFrom<TVariantAlternative<I, TVariant<Ts...>>, ArgTypes...>)
constexpr TVariantAlternative<I, TVariant<Ts...>>& Emplace(ArgTypes&&... Args) constexpr TVariantAlternative<I, TVariant<Ts...>>& Emplace(ArgTypes&&... Args)
{ {
Reset(); Reset();
@ -255,7 +255,7 @@ public:
return *Result; return *Result;
} }
template <typename T, typename... ArgTypes> requires CConstructibleFrom<T, ArgTypes...> template <typename T, typename... ArgTypes> requires (CConstructibleFrom<T, ArgTypes...>)
constexpr T& Emplace(ArgTypes&&... Args) constexpr T& Emplace(ArgTypes&&... Args)
{ {
return Emplace<TVariantIndex<T, TVariant<Ts...>>>(Forward<ArgTypes>(Args)...); return Emplace<TVariantIndex<T, TVariant<Ts...>>>(Forward<ArgTypes>(Args)...);
@ -452,7 +452,7 @@ private:
}; };
template <typename T, typename... Ts> requires (!CSameAs<T, TVariant<Ts...>>) && CEqualityComparable<T> template <typename T, typename... Ts> requires (!CSameAs<T, TVariant<Ts...>> && CEqualityComparable<T>)
constexpr bool operator==(const TVariant<Ts...>& LHS, const T& RHS) constexpr bool operator==(const TVariant<Ts...>& 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

@ -135,7 +135,7 @@ template <typename T, typename U> concept CCommonTypeImpl = requires { typename
template <typename T, typename U> requires (!CSimpleCommonReference<T, U> && !CBasicCommonReference<T, U> && !CConditionalValType<T, U> && CCommonTypeImpl<T, U>) template <typename T, typename U> requires (!CSimpleCommonReference<T, U> && !CBasicCommonReference<T, U> && !CConditionalValType<T, U> && CCommonTypeImpl<T, U>)
struct TCommonReferenceImpl<T, U> : TCommonTypeImpl<T, U> { }; struct TCommonReferenceImpl<T, U> : TCommonTypeImpl<T, U> { };
// Otherwise, there is no member Type. // Otherwise, there is no member Type
// If sizeof...(Ts) is greater than two // If sizeof...(Ts) is greater than two
@ -143,7 +143,7 @@ struct TCommonReferenceImpl<T, U> : TCommonTypeImpl<T, U> { };
template <typename T, typename U, typename W, typename... Ts> requires (requires { typename TCommonReferenceImpl<T, U>::Type; }) template <typename T, typename U, typename W, typename... Ts> requires (requires { typename TCommonReferenceImpl<T, U>::Type; })
struct TCommonReferenceImpl<T, U, W, Ts...> : TCommonReferenceImpl<typename TCommonReferenceImpl<T, U>::Type, W, Ts...> { }; struct TCommonReferenceImpl<T, U, W, Ts...> : TCommonReferenceImpl<typename TCommonReferenceImpl<T, U>::Type, W, Ts...> { };
// In all other cases, there is no member Type. // In all other cases, there is no member Type
template <typename...> template <typename...>
struct TCommonReferenceImpl { }; struct TCommonReferenceImpl { };
@ -166,7 +166,7 @@ template <typename T, typename U> requires (CConvertibleTo<U&&, typename TSimple
struct TSimpleCommonReferenceImpl<T&, U&&> { using Type = typename TSimpleCommonReferenceImpl<T&, const U&>::Type; }; struct TSimpleCommonReferenceImpl<T&, U&&> { using Type = typename TSimpleCommonReferenceImpl<T&, const U&>::Type; };
template <typename T, typename U> struct TSimpleCommonReferenceImpl<T&&, U&> : TSimpleCommonReferenceImpl<U&, T&&> { }; // The order is not important template <typename T, typename U> struct TSimpleCommonReferenceImpl<T&&, U&> : TSimpleCommonReferenceImpl<U&, T&&> { }; // The order is not important
// Otherwise, there's no simple common reference Type. // Otherwise, there's no simple common reference Type
template <typename T, typename U> template <typename T, typename U>
struct TSimpleCommonReferenceImpl { }; struct TSimpleCommonReferenceImpl { };