refactor(typetraits): TIsDestructible use Cpp17Destructible requirements instead of std::is_destructible
This commit is contained in:
@ -78,8 +78,7 @@ struct alignas(InlineAlignment) TAny
|
||||
}
|
||||
|
||||
template <typename T> requires (!TIsSame<typename TDecay<T>::Type, TAny>::Value) && (!TIsTInPlaceType<typename TDecay<T>::Type>::Value)
|
||||
&& TIsObject<typename TDecay<T>::Type>::Value && (!TIsArray<typename TDecay<T>::Type>::Value) && TIsDestructible<typename TDecay<T>::Type>::Value
|
||||
&& TIsConstructible<typename TDecay<T>::Type, T&&>::Value
|
||||
&& TIsDestructible<typename TDecay<T>::Type>::Value && TIsConstructible<typename TDecay<T>::Type, T&&>::Value
|
||||
FORCEINLINE TAny(T&& InValue) : TAny(InPlaceType<typename TDecay<T>::Type>, Forward<T>(InValue))
|
||||
{ }
|
||||
|
||||
@ -187,8 +186,7 @@ struct alignas(InlineAlignment) TAny
|
||||
}
|
||||
|
||||
template <typename T> requires (!TIsSame<typename TDecay<T>::Type, TAny>::Value) && (!TIsTInPlaceType<typename TDecay<T>::Type>::Value)
|
||||
&& TIsObject<typename TDecay<T>::Type>::Value && (!TIsArray<typename TDecay<T>::Type>::Value) && TIsDestructible<typename TDecay<T>::Type>::Value
|
||||
&& TIsConstructible<typename TDecay<T>::Type, T&&>::Value
|
||||
&& TIsDestructible<typename TDecay<T>::Type>::Value && TIsConstructible<typename TDecay<T>::Type, T&&>::Value
|
||||
FORCEINLINE TAny& operator=(T&& InValue)
|
||||
{
|
||||
using SelectedType = typename TDecay<T>::Type;
|
||||
@ -225,22 +223,22 @@ struct alignas(InlineAlignment) TAny
|
||||
|
||||
template <typename T> constexpr bool HoldsAlternative() const { return IsValid() ? GetTypeInfo() == typeid(T) : false; }
|
||||
|
||||
template <typename T> requires TIsSame<T, typename TDecay<T>::Type>::Value && TIsObject<typename TDecay<T>::Type>::Value && (!TIsArray<typename TDecay<T>::Type>::Value) && TIsDestructible<typename TDecay<T>::Type>::Value
|
||||
template <typename T> requires TIsDestructible<typename TDecay<T>::Type>::Value
|
||||
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 TIsSame<T, typename TDecay<T>::Type>::Value && TIsObject<typename TDecay<T>::Type>::Value && (!TIsArray<typename TDecay<T>::Type>::Value) && TIsDestructible<typename TDecay<T>::Type>::Value
|
||||
template <typename T> requires TIsDestructible<typename TDecay<T>::Type>::Value
|
||||
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 TIsSame<T, typename TDecay<T>::Type>::Value && TIsObject<typename TDecay<T>::Type>::Value && (!TIsArray<typename TDecay<T>::Type>::Value) && TIsDestructible<typename TDecay<T>::Type>::Value
|
||||
template <typename T> requires TIsDestructible<typename TDecay<T>::Type>::Value
|
||||
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 TIsSame<T, typename TDecay<T>::Type>::Value && TIsObject<typename TDecay<T>::Type>::Value && (!TIsArray<typename TDecay<T>::Type>::Value) && TIsDestructible<typename TDecay<T>::Type>::Value
|
||||
template <typename T> requires TIsDestructible<typename TDecay<T>::Type>::Value
|
||||
constexpr const T&& GetValue() const&& { checkf(HoldsAlternative<T>(), TEXT("It is an error to call GetValue() on an wrong TAny. Please either check HoldsAlternative() or use Get(DefaultValue) instead.")); return MoveTemp(*reinterpret_cast<const T*>(GetAllocation())); }
|
||||
|
||||
template <typename T> requires TIsSame<T, typename TDecay<T>::Type>::Value&& TIsObject<typename TDecay<T>::Type>::Value && (!TIsArray<typename TDecay<T>::Type>::Value) && TIsDestructible<typename TDecay<T>::Type>::Value
|
||||
template <typename T> requires TIsSame<T, typename TDecay<T>::Type>::Value&& TIsDestructible<typename TDecay<T>::Type>::Value
|
||||
constexpr T& Get( T& DefaultValue) & { return HoldsAlternative<T>() ? GetValue<T>() : DefaultValue; }
|
||||
|
||||
template <typename T> requires TIsSame<T, typename TDecay<T>::Type>::Value&& TIsObject<typename TDecay<T>::Type>::Value && (!TIsArray<typename TDecay<T>::Type>::Value) && TIsDestructible<typename TDecay<T>::Type>::Value
|
||||
template <typename T> requires TIsSame<T, typename TDecay<T>::Type>::Value&& TIsDestructible<typename TDecay<T>::Type>::Value
|
||||
constexpr const T& Get(const T& DefaultValue) const& { return HoldsAlternative<T>() ? GetValue<T>() : DefaultValue; }
|
||||
|
||||
FORCEINLINE void Reset()
|
||||
|
@ -107,10 +107,10 @@ public:
|
||||
|
||||
FORCEINLINE const type_info& TargetType() const requires (!bIsRef) { return IsValid() ? Storage.GetTypeInfo() : typeid(void); };
|
||||
|
||||
template <typename T> FORCEINLINE T& Target() & requires (!bIsRef) && TIsSame<T, typename TDecay<T>::Type>::Value && TIsObject<typename TDecay<T>::Type>::Value && (!TIsArray<typename TDecay<T>::Type>::Value) && TIsDestructible<typename TDecay<T>::Type>::Value { return static_cast< StorageType& >(Storage).template GetValue<T>(); }
|
||||
template <typename T> FORCEINLINE T&& Target() && requires (!bIsRef) && TIsSame<T, typename TDecay<T>::Type>::Value && TIsObject<typename TDecay<T>::Type>::Value && (!TIsArray<typename TDecay<T>::Type>::Value) && TIsDestructible<typename TDecay<T>::Type>::Value { return static_cast< StorageType&&>(Storage).template GetValue<T>(); }
|
||||
template <typename T> FORCEINLINE const T& Target() const& requires (!bIsRef) && TIsSame<T, typename TDecay<T>::Type>::Value && TIsObject<typename TDecay<T>::Type>::Value && (!TIsArray<typename TDecay<T>::Type>::Value) && TIsDestructible<typename TDecay<T>::Type>::Value { return static_cast<const StorageType& >(Storage).template GetValue<T>(); }
|
||||
template <typename T> FORCEINLINE const T&& Target() const&& requires (!bIsRef) && TIsSame<T, typename TDecay<T>::Type>::Value && TIsObject<typename TDecay<T>::Type>::Value && (!TIsArray<typename TDecay<T>::Type>::Value) && TIsDestructible<typename TDecay<T>::Type>::Value { return static_cast<const StorageType&&>(Storage).template GetValue<T>(); }
|
||||
template <typename T> FORCEINLINE T& Target() & requires (!bIsRef) && TIsDestructible<typename TDecay<T>::Type>::Value { return static_cast< StorageType& >(Storage).template GetValue<T>(); }
|
||||
template <typename T> FORCEINLINE T&& Target() && requires (!bIsRef) && TIsDestructible<typename TDecay<T>::Type>::Value { return static_cast< StorageType&&>(Storage).template GetValue<T>(); }
|
||||
template <typename T> FORCEINLINE const T& Target() const& requires (!bIsRef) && TIsDestructible<typename TDecay<T>::Type>::Value { return static_cast<const StorageType& >(Storage).template GetValue<T>(); }
|
||||
template <typename T> FORCEINLINE const T&& Target() const&& requires (!bIsRef) && TIsDestructible<typename TDecay<T>::Type>::Value { return static_cast<const StorageType&&>(Storage).template GetValue<T>(); }
|
||||
|
||||
constexpr void Swap(TFunctionImpl& InValue) requires (!bIsRef)
|
||||
{
|
||||
|
Reference in New Issue
Block a user