Michele Caini 7 лет назад
Родитель
Сommit
cbb1131a5d

+ 2 - 2
TODO

@@ -13,12 +13,12 @@
 * meta: sort of meta view based on meta stuff to iterate entities, void * and meta info objects
 * meta: move-to-head optimization when searching by name on parts (data, func, etc)
 * hashed string: add implicit check on construction for uniqueness (optional)
-* signals on entity creation/destruction
 * destroy overload that accepts a couple of iterators (see create)
 * allow for built-in parallel each if possible
 * add on-the-fly sort functionality (is it possible?)
 * write/show how to create an archetype based model on top of EnTT
 * mention hunter in the readme file, section packaging tools
-* monostate: make constraint trivially copyable due to atomic optional
 * travis + windows is now available, try it
 * events on replace, so that one can track updated components? indagate impact
+* add entt::exclude as alias of entt::type_list
+* add sparse_set::swap and registry::swap

+ 10 - 0
src/entt/config/config.h

@@ -12,4 +12,14 @@
 #endif // ENTT_HS_SUFFIX
 
 
+#ifndef ENTT_NO_ATOMIC
+#include <atomic>
+template<typename Type>
+using maybe_atomic_type = std::atomic<Type>;
+#else
+template<typename Type>
+using maybe_atomic_type = Type;
+#endif // ENTT_USE_ATOMIC
+
+
 #endif // ENTT_CONFIG_CONFIG_H

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

@@ -4,7 +4,6 @@
 
 #include <type_traits>
 #include <cstddef>
-#include <atomic>
 #include "../config/config.h"
 
 
@@ -20,10 +19,10 @@ namespace entt {
  */
 template<typename...>
 class family {
-    inline static std::atomic<std::size_t> identifier;
+    inline static maybe_atomic_type<std::size_t> identifier;
 
     template<typename...>
-    inline static const auto inner = identifier.fetch_add(1);
+    inline static const auto inner = identifier++;
 
 public:
     /*! @brief Unsigned integer type. */

+ 2 - 2
src/entt/core/monostate.hpp

@@ -2,8 +2,8 @@
 #define ENTT_CORE_MONOSTATE_HPP
 
 
-#include <atomic>
 #include <cassert>
+#include "../config/config.h"
 #include "hashed_string.hpp"
 
 
@@ -45,7 +45,7 @@ struct monostate {
 
 private:
     template<typename Type>
-    inline static std::atomic<Type> value{};
+    inline static maybe_atomic_type<Type> value{};
 };
 
 

+ 1 - 0
src/entt/meta/factory.hpp

@@ -6,6 +6,7 @@
 #include <utility>
 #include <algorithm>
 #include <type_traits>
+#include "../config/config.h"
 #include "../core/hashed_string.hpp"
 #include "meta.hpp"
 

+ 1 - 0
src/entt/meta/meta.hpp

@@ -10,6 +10,7 @@
 #include <cstddef>
 #include <utility>
 #include <type_traits>
+#include "../config/config.h"
 #include "../core/hashed_string.hpp"
 
 

+ 1 - 1
src/entt/process/process.hpp

@@ -2,8 +2,8 @@
 #define ENTT_PROCESS_PROCESS_HPP
 
 
-#include <type_traits>
 #include <utility>
+#include <type_traits>
 #include "../config/config.h"