Explorar o código

config/type_id: minor changes

Michele Caini %!s(int64=5) %!d(string=hai) anos
pai
achega
090a2595e1
Modificáronse 2 ficheiros con 6 adicións e 10 borrados
  1. 3 2
      src/entt/config/config.h
  2. 3 8
      src/entt/core/type_info.hpp

+ 3 - 2
src/entt/config/config.h

@@ -55,12 +55,13 @@
 #ifndef ENTT_STANDARD_CPP
 #   if defined _MSC_VER
 #      define ENTT_PRETTY_FUNCTION __FUNCSIG__
-#      define ENTT_PRETTY_FUNCTION_CONSTEXPR ENTT_PRETTY_FUNCTION
+#      define ENTT_PRETTY_FUNCTION_CONSTEXPR(...) constexpr
 #   elif defined __clang__ || (defined __GNUC__ && __GNUC__ > 8)
 #      define ENTT_PRETTY_FUNCTION __PRETTY_FUNCTION__
-#      define ENTT_PRETTY_FUNCTION_CONSTEXPR ENTT_PRETTY_FUNCTION
+#      define ENTT_PRETTY_FUNCTION_CONSTEXPR(...) constexpr
 #   elif defined __GNUC__
 #      define ENTT_PRETTY_FUNCTION __PRETTY_FUNCTION__
+#      define ENTT_PRETTY_FUNCTION_CONSTEXPR(...) __VA_ARGS__
 #   endif
 #endif
 

+ 3 - 8
src/entt/core/type_info.hpp

@@ -86,14 +86,9 @@ struct ENTT_API type_info {
      * @brief Returns the numeric representation of a given type.
      * @return The numeric representation of the given type.
      */
-#if defined ENTT_PRETTY_FUNCTION_CONSTEXPR
-    static constexpr id_type id() ENTT_NOEXCEPT {
-        constexpr auto value = entt::hashed_string::value(ENTT_PRETTY_FUNCTION_CONSTEXPR);
-        return value;
-    }
-#elif defined ENTT_PRETTY_FUNCTION
-    static id_type id() ENTT_NOEXCEPT {
-        static const auto value = entt::hashed_string::value(ENTT_PRETTY_FUNCTION);
+#if defined ENTT_PRETTY_FUNCTION
+    static ENTT_PRETTY_FUNCTION_CONSTEXPR() id_type id() ENTT_NOEXCEPT {
+        ENTT_PRETTY_FUNCTION_CONSTEXPR(static const) auto value = entt::hashed_string::value(ENTT_PRETTY_FUNCTION);
         return value;
     }
 #else