diff options
Diffstat (limited to 'core/variant')
-rw-r--r-- | core/variant/binder_common.h | 8 | ||||
-rw-r--r-- | core/variant/type_info.h | 12 |
2 files changed, 8 insertions, 12 deletions
diff --git a/core/variant/binder_common.h b/core/variant/binder_common.h index c9f5ae7fc6..a44b938395 100644 --- a/core/variant/binder_common.h +++ b/core/variant/binder_common.h @@ -51,7 +51,7 @@ template <class T> struct VariantCaster { static _FORCE_INLINE_ T cast(const Variant &p_variant) { using TStripped = std::remove_pointer_t<T>; - if constexpr (std::is_base_of<Object, TStripped>::value) { + if constexpr (std::is_base_of_v<Object, TStripped>) { return Object::cast_to<TStripped>(p_variant); } else { return p_variant; @@ -63,7 +63,7 @@ template <class T> struct VariantCaster<T &> { static _FORCE_INLINE_ T cast(const Variant &p_variant) { using TStripped = std::remove_pointer_t<T>; - if constexpr (std::is_base_of<Object, TStripped>::value) { + if constexpr (std::is_base_of_v<Object, TStripped>) { return Object::cast_to<TStripped>(p_variant); } else { return p_variant; @@ -75,7 +75,7 @@ template <class T> struct VariantCaster<const T &> { static _FORCE_INLINE_ T cast(const Variant &p_variant) { using TStripped = std::remove_pointer_t<T>; - if constexpr (std::is_base_of<Object, TStripped>::value) { + if constexpr (std::is_base_of_v<Object, TStripped>) { return Object::cast_to<TStripped>(p_variant); } else { return p_variant; @@ -226,7 +226,7 @@ template <typename T> struct VariantObjectClassChecker { static _FORCE_INLINE_ bool check(const Variant &p_variant) { using TStripped = std::remove_pointer_t<T>; - if constexpr (std::is_base_of<Object, TStripped>::value) { + if constexpr (std::is_base_of_v<Object, TStripped>) { Object *obj = p_variant; return Object::cast_to<TStripped>(p_variant) || !obj; } else { diff --git a/core/variant/type_info.h b/core/variant/type_info.h index c1f2f86a96..49c4db8229 100644 --- a/core/variant/type_info.h +++ b/core/variant/type_info.h @@ -43,14 +43,10 @@ struct EnableIf<false, T> { }; template <typename, typename> -struct TypesAreSame { - static bool const value = false; -}; +inline constexpr bool types_are_same_v = false; -template <typename A> -struct TypesAreSame<A, A> { - static bool const value = true; -}; +template <typename T> +inline constexpr bool types_are_same_v<T, T> = true; template <typename B, typename D> struct TypeInherits { @@ -60,7 +56,7 @@ struct TypeInherits { static char (&test(...))[2]; static bool const value = sizeof(test(get_d())) == sizeof(char) && - !TypesAreSame<B volatile const, void volatile const>::value; + !types_are_same_v<B volatile const, void volatile const>; }; namespace GodotTypeInfo { |