Selaa lähdekoodia

family: rework/get rid of NOLINT

skypjack 7 kuukautta sitten
vanhempi
commit
9b3965c2c9
1 muutettua tiedostoa jossa 5 lisäystä ja 3 poistoa
  1. 5 3
      src/entt/core/family.hpp

+ 5 - 3
src/entt/core/family.hpp

@@ -15,8 +15,10 @@ namespace entt {
  */
  */
 template<typename...>
 template<typename...>
 class family {
 class family {
-    // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
-    inline static ENTT_MAYBE_ATOMIC(id_type) identifier{};
+    static auto identifier() noexcept {
+        static ENTT_MAYBE_ATOMIC(id_type) value{};
+        return value++;
+    }
 
 
 public:
 public:
     /*! @brief Unsigned integer type. */
     /*! @brief Unsigned integer type. */
@@ -25,7 +27,7 @@ public:
     /*! @brief Statically generated unique identifier for the given type. */
     /*! @brief Statically generated unique identifier for the given type. */
     template<typename... Type>
     template<typename... Type>
     // at the time I'm writing, clang crashes during compilation if auto is used instead of family_type
     // at the time I'm writing, clang crashes during compilation if auto is used instead of family_type
-    inline static const value_type value = identifier++;
+    inline static const value_type value = identifier();
 };
 };
 
 
 } // namespace entt
 } // namespace entt