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

This commit is contained in:
2022-05-15 22:56:53 +08:00
parent 5d1f622af8
commit 1dcd3dc3b3
18 changed files with 152 additions and 156 deletions

View File

@ -10,7 +10,7 @@ NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility)
template <typename ReferencedType> requires (TIsObject<ReferencedType>::Value || TIsFunction<ReferencedType>::Value)
template <typename ReferencedType> requires (TIsObject<ReferencedType>::Value || CFunction<ReferencedType>)
struct TReferenceWrapper
{
public:
@ -61,11 +61,11 @@ private:
ReferencedType* Pointer;
template <typename T> requires (TIsObject<T>::Value || TIsFunction<T>::Value) friend struct TReferenceWrapper;
template <typename T> requires (TIsObject<T>::Value || CFunction<T>) friend struct TReferenceWrapper;
// Optimize TOptional with these hacking
constexpr TReferenceWrapper(FInvalid) : Pointer(nullptr) { };
template <typename T> requires TIsObject<T>::Value && (!TIsArray<T>::Value) && TIsDestructible<T>::Value friend struct TOptional;
template <typename T> requires TIsDestructible<T>::Value friend struct TOptional;
};
@ -221,7 +221,7 @@ public:
private:
TReferenceWrapper<ReferencedType> Reference;
template <typename T> requires TIsObject<T>::Value && (!TIsArray<T>::Value) && TIsDestructible<T>::Value friend struct TOptional;
template <typename T> requires TIsDestructible<T>::Value friend struct TOptional;
};