diff --git a/TODO b/TODO index 105f16fe6..1e06ec6d1 100644 --- a/TODO +++ b/TODO @@ -22,6 +22,5 @@ - standard each, use bitmask to speed up the whole thing and avoid accessing the pools to test for the page - iterator based each with a couple of iterators passed from outside (use bitmask + has) * stable component handle that isn't affected by reallocations -* default constructor + init/re-init function to actor * multi component registry::remove and some others? * built-in support for dual (or N-) buffering diff --git a/src/entt/entity/actor.hpp b/src/entt/entity/actor.hpp index 6757b4e82..41fbbfde1 100644 --- a/src/entt/entity/actor.hpp +++ b/src/entt/entity/actor.hpp @@ -29,6 +29,10 @@ struct basic_actor { /*! @brief Underlying entity identifier. */ using entity_type = Entity; + basic_actor() ENTT_NOEXCEPT + : reg{nullptr}, entt{entt::null} + {} + /** * @brief Constructs an actor by using the given registry. * @param ref An entity-component system properly initialized. diff --git a/test/entt/entity/actor.cpp b/test/entt/entity/actor.cpp index 9ae1483a6..b23ee9cee 100644 --- a/test/entt/entity/actor.cpp +++ b/test/entt/entity/actor.cpp @@ -42,11 +42,16 @@ TEST(Actor, Component) { TEST(Actor, EntityLifetime) { entt::registry registry; - entt::actor actor{registry}; + entt::actor actor{}; + + ASSERT_FALSE(actor); + + actor = entt::actor{registry}; actor.assign(); ASSERT_TRUE(actor); - ASSERT_TRUE(actor); + ASSERT_FALSE(registry.empty()); + ASSERT_FALSE(registry.empty()); registry.destroy(actor.entity());