diff --git a/core/object/class_db.h b/core/object/class_db.h index adb525cbe87..37a864c1090 100644 --- a/core/object/class_db.h +++ b/core/object/class_db.h @@ -195,7 +195,7 @@ public: template static void register_class(bool p_virtual = false) { GLOBAL_LOCK_FUNCTION; - static_assert(types_are_same_v, "Class not declared properly, please use GDCLASS."); + static_assert(std::is_same_v, "Class not declared properly, please use GDCLASS."); T::initialize_class(); ClassInfo *t = classes.getptr(T::get_class_static()); ERR_FAIL_NULL(t); @@ -210,7 +210,7 @@ public: template static void register_abstract_class() { GLOBAL_LOCK_FUNCTION; - static_assert(types_are_same_v, "Class not declared properly, please use GDCLASS."); + static_assert(std::is_same_v, "Class not declared properly, please use GDCLASS."); T::initialize_class(); ClassInfo *t = classes.getptr(T::get_class_static()); ERR_FAIL_NULL(t); @@ -223,7 +223,7 @@ public: template static void register_internal_class() { GLOBAL_LOCK_FUNCTION; - static_assert(types_are_same_v, "Class not declared properly, please use GDCLASS."); + static_assert(std::is_same_v, "Class not declared properly, please use GDCLASS."); T::initialize_class(); ClassInfo *t = classes.getptr(T::get_class_static()); ERR_FAIL_NULL(t); @@ -238,7 +238,7 @@ public: template static void register_runtime_class() { GLOBAL_LOCK_FUNCTION; - static_assert(types_are_same_v, "Class not declared properly, please use GDCLASS."); + static_assert(std::is_same_v, "Class not declared properly, please use GDCLASS."); T::initialize_class(); ClassInfo *t = classes.getptr(T::get_class_static()); ERR_FAIL_NULL(t); @@ -263,7 +263,7 @@ public: template static void register_custom_instance_class() { GLOBAL_LOCK_FUNCTION; - static_assert(types_are_same_v, "Class not declared properly, please use GDCLASS."); + static_assert(std::is_same_v, "Class not declared properly, please use GDCLASS."); T::initialize_class(); ClassInfo *t = classes.getptr(T::get_class_static()); ERR_FAIL_NULL(t); diff --git a/core/variant/type_info.h b/core/variant/type_info.h index 9c52db33452..15cb6c9c1aa 100644 --- a/core/variant/type_info.h +++ b/core/variant/type_info.h @@ -33,31 +33,7 @@ #include "core/typedefs.h" -template -struct EnableIf { - typedef T type; -}; - -template -struct EnableIf { -}; - -template -inline constexpr bool types_are_same_v = false; - -template -inline constexpr bool types_are_same_v = true; - -template -struct TypeInherits { - static D *get_d(); - - static char (&test(B *))[1]; - static char (&test(...))[2]; - - static bool const value = sizeof(test(get_d())) == sizeof(char) && - !types_are_same_v; -}; +#include namespace GodotTypeInfo { enum Metadata { @@ -223,16 +199,7 @@ MAKE_TEMPLATE_TYPE_INFO(Vector, Face3, Variant::PACKED_VECTOR3_ARRAY) MAKE_TEMPLATE_TYPE_INFO(Vector, StringName, Variant::PACKED_STRING_ARRAY) template -struct GetTypeInfo::value>::type> { - static const Variant::Type VARIANT_TYPE = Variant::OBJECT; - static const GodotTypeInfo::Metadata METADATA = GodotTypeInfo::METADATA_NONE; - static inline PropertyInfo get_class_info() { - return PropertyInfo(StringName(T::get_class_static())); - } -}; - -template -struct GetTypeInfo::value>::type> { +struct GetTypeInfo>> { static const Variant::Type VARIANT_TYPE = Variant::OBJECT; static const GodotTypeInfo::Metadata METADATA = GodotTypeInfo::METADATA_NONE; static inline PropertyInfo get_class_info() {