diff --git a/TODO b/TODO index 8b8c1ee3d..3f3763c83 100644 --- a/TODO +++ b/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 diff --git a/src/entt/config/config.h b/src/entt/config/config.h index f6460f811..0c1f5c9d8 100644 --- a/src/entt/config/config.h +++ b/src/entt/config/config.h @@ -12,4 +12,14 @@ #endif // ENTT_HS_SUFFIX +#ifndef ENTT_NO_ATOMIC +#include +template +using maybe_atomic_type = std::atomic; +#else +template +using maybe_atomic_type = Type; +#endif // ENTT_USE_ATOMIC + + #endif // ENTT_CONFIG_CONFIG_H diff --git a/src/entt/core/family.hpp b/src/entt/core/family.hpp index d6abb5dd0..e63c1ac49 100644 --- a/src/entt/core/family.hpp +++ b/src/entt/core/family.hpp @@ -4,7 +4,6 @@ #include #include -#include #include "../config/config.h" @@ -20,10 +19,10 @@ namespace entt { */ template class family { - inline static std::atomic identifier; + inline static maybe_atomic_type identifier; template - inline static const auto inner = identifier.fetch_add(1); + inline static const auto inner = identifier++; public: /*! @brief Unsigned integer type. */ diff --git a/src/entt/core/monostate.hpp b/src/entt/core/monostate.hpp index 53aea1257..b2f312d96 100644 --- a/src/entt/core/monostate.hpp +++ b/src/entt/core/monostate.hpp @@ -2,8 +2,8 @@ #define ENTT_CORE_MONOSTATE_HPP -#include #include +#include "../config/config.h" #include "hashed_string.hpp" @@ -45,7 +45,7 @@ struct monostate { private: template - inline static std::atomic value{}; + inline static maybe_atomic_type value{}; }; diff --git a/src/entt/meta/factory.hpp b/src/entt/meta/factory.hpp index 196a62f22..1f23baf6a 100644 --- a/src/entt/meta/factory.hpp +++ b/src/entt/meta/factory.hpp @@ -6,6 +6,7 @@ #include #include #include +#include "../config/config.h" #include "../core/hashed_string.hpp" #include "meta.hpp" diff --git a/src/entt/meta/meta.hpp b/src/entt/meta/meta.hpp index 803c37bff..7fef682f8 100644 --- a/src/entt/meta/meta.hpp +++ b/src/entt/meta/meta.hpp @@ -10,6 +10,7 @@ #include #include #include +#include "../config/config.h" #include "../core/hashed_string.hpp" diff --git a/src/entt/process/process.hpp b/src/entt/process/process.hpp index d3b0281d4..edd91e30d 100644 --- a/src/entt/process/process.hpp +++ b/src/entt/process/process.hpp @@ -2,8 +2,8 @@ #define ENTT_PROCESS_PROCESS_HPP -#include #include +#include #include "../config/config.h"