Просмотр исходного кода

removed Registry::persistent/Registry::raw

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

+ 25 - 16
README.md

@@ -539,7 +539,7 @@ data structures or more complex and movable data structures with a proper
 constructor.<br/>
 Actually, the same type can be used both as a tag and as a component and the
 registry will not complain about it. It is up to the users to properly manage
-their own types. In some cases, the `tag_type_t` must also be used in order to
+their own types. In some cases, the tag `tag_t` must also be used in order to
 disambiguate overloads of member functions.
 
 Attaching tags to entities and removing them is trivial:
@@ -549,10 +549,10 @@ auto player = registry.create();
 auto camera = registry.create();
 
 // attaches a default-initialized tag to an entity
-registry.assign<PlayingCharacter>(entt::tag_type_t{}, player);
+registry.assign<PlayingCharacter>(entt::tag_t{}, player);
 
 // attaches a tag to an entity and initializes it
-registry.assign<Camera>(entt::tag_type_t{}, camera, player);
+registry.assign<Camera>(entt::tag_t{}, camera, player);
 
 // removes tags from their owners
 registry.remove<PlayingCharacter>();
@@ -565,7 +565,7 @@ transferred to another entity using the `move` member function template:
 
 ```
 // replaces the content of the given tag
-Point &point = registry.replace<Point>(entt::tag_type_t{}, 1.f, 1.f);
+Point &point = registry.replace<Point>(entt::tag_t{}, 1.f, 1.f);
 
 // transfers the ownership of the tag to another entity
 entity_type prev = registry.move<Point>(next);
@@ -671,12 +671,12 @@ Signals for tags undergo exactly the same requirements of those introduced for
 components. Also the function type for a listener is the same and it's invoked
 with the same guarantees discussed above.
 
-To get the sinks for a tag just use `entt::tag_type_t` to disambiguate overloads
-of member functions as in the following example:
+To get the sinks for a tag just use tag `tag_t` to disambiguate overloads of
+member functions as in the following example:
 
 ```cpp
-registry.construction<MyTag>(entt::tag_type_t{}).connect<&MyFreeFunction>();
-registry.destruction<MyTag>(entt::tag_type_t{}).connect<MyClass, &MyClass::member>(&instance);
+registry.construction<MyTag>(entt::tag_t{}).connect<&MyFreeFunction>();
+registry.destruction<MyTag>(entt::tag_t{}).connect<MyClass, &MyClass::member>(&instance);
 ```
 
 Listeners for tags and components are managed separately and do not influence
@@ -1025,7 +1025,7 @@ be overriden.<br/>
 A dependency can easily be broken by means of the same function template:
 
 ```cpp
-entt::dependency<AType, AnotherType>(entt::break_op_t{}, registry.construction<MyType>());
+entt::dependency<AType, AnotherType>(entt::break_t{}, registry.construction<MyType>());
 ```
 
 ## View: to persist or not to persist?
@@ -1231,11 +1231,12 @@ tightly packed in memory for fast iterations.<br/>
 In general, persistent views don't stay true to the order of any set of
 components unless users explicitly sort them.
 
-Persistent views can be used only to iterate multiple components. Create them
-as it follows:
+Persistent views can be used only to iterate multiple components. To create this
+kind of views, the tag `persistent_t` must also be used in order to disambiguate
+overloads of the `view` member function:
 
 ```cpp
-auto view = registry.persistent<Position, Velocity>();
+auto view = registry.view<Position, Velocity>(entt::persistent_t{});
 ```
 
 There is no need to store views around for they are extremely cheap to
@@ -1266,7 +1267,7 @@ the details.
 To iterate a persistent view, either use it in range-for loop:
 
 ```cpp
-auto view = registry.persistent<Position, Velocity>();
+auto view = registry.view<Position, Velocity>(entt::persistent_t{});
 
 for(auto entity: view) {
     // a component at a time ...
@@ -1284,7 +1285,7 @@ Or rely on the `each` member function to iterate entities and get all their
 components at once:
 
 ```cpp
-registry.persistent<Position, Velocity>().each([](auto entity, auto &position, auto &velocity) {
+registry.view<Position, Velocity>(entt::persistent_t{}).each([](auto entity, auto &position, auto &velocity) {
     // ...
 });
 ```
@@ -1299,7 +1300,7 @@ mind that it works only with the components of the view itself.
 ### Raw View
 
 Raw views return all the components of a given type. This kind of views can
-access components directly and avoid extra indirections as if components were
+access components directly and avoid extra indirections like when components are
 accessed via an entity identifier.<br/>
 They offer a bunch of functionalities to get the number of instances they are
 going to return and a raw access to the entity list as well as to the component
@@ -1307,6 +1308,14 @@ list.<br/>
 Refer to the [official documentation](https://skypjack.github.io/entt/) for all
 the details.
 
+Raw views can be used only to iterate components for a single type. To create
+this kind of views, the tag `raw_t` must also be used in order to disambiguate
+overloads of the `view` member function:
+
+```cpp
+auto view = registry.view<Renderable>(entt::raw_t{});
+```
+
 There is no need to store views around for they are extremely cheap to
 construct, even though they can be copied without problems and reused freely. In
 fact, they return newly created and correctly initialized iterators whenever
@@ -1314,7 +1323,7 @@ fact, they return newly created and correctly initialized iterators whenever
 To iterate a raw view, use it in range-for loop:
 
 ```cpp
-auto view = registry.raw<Renderable>();
+auto view = registry.view<Renderable>(entt::raw_t{});
 
 for(auto &&component: raw) {
     // ...

+ 9 - 9
src/entt/entity/actor.hpp

@@ -64,8 +64,8 @@ struct Actor {
      * @return A reference to the newly created tag.
      */
     template<typename Tag, typename... Args>
-    Tag & assign(tag_type_t, Args &&... args) {
-        return (reg.template remove<Tag>(), reg.template assign<Tag>(tag_type_t{}, entt, std::forward<Args>(args)...));
+    Tag & assign(tag_t, Args &&... args) {
+        return (reg.template remove<Tag>(), reg.template assign<Tag>(tag_t{}, entt, std::forward<Args>(args)...));
     }
 
     /**
@@ -92,8 +92,8 @@ struct Actor {
      * @tparam Tag Type of the tag to remove.
      */
     template<typename Tag>
-    void remove(tag_type_t) {
-        assert(has<Tag>(tag_type_t{}));
+    void remove(tag_t) {
+        assert(has<Tag>(tag_t{}));
         reg.template remove<Tag>();
     }
 
@@ -112,7 +112,7 @@ struct Actor {
      * @return True if the actor owns the tag, false otherwise.
      */
     template<typename Tag>
-    bool has(tag_type_t) const ENTT_NOEXCEPT {
+    bool has(tag_t) const ENTT_NOEXCEPT {
         return (reg.template has<Tag>() && (reg.template attachee<Tag>() == entt));
     }
 
@@ -132,8 +132,8 @@ struct Actor {
      * @return A reference to the instance of the tag owned by the actor.
      */
     template<typename Tag>
-    const Tag & get(tag_type_t) const ENTT_NOEXCEPT {
-        assert(has<Tag>(tag_type_t{}));
+    const Tag & get(tag_t) const ENTT_NOEXCEPT {
+        assert(has<Tag>(tag_t{}));
         return reg.template get<Tag>();
     }
 
@@ -143,8 +143,8 @@ struct Actor {
      * @return A reference to the instance of the tag owned by the actor.
      */
     template<typename Tag>
-    Tag & get(tag_type_t) ENTT_NOEXCEPT {
-        return const_cast<Tag &>(const_cast<const Actor *>(this)->get<Tag>(tag_type_t{}));
+    Tag & get(tag_t) ENTT_NOEXCEPT {
+        return const_cast<Tag &>(const_cast<const Actor *>(this)->get<Tag>(tag_t{}));
     }
 
     /**

+ 2 - 2
src/entt/entity/helper.hpp

@@ -65,7 +65,7 @@ void dependency(Sink<void(Registry<Entity> &, Entity)> sink) {
  * components `AType` and `AnotherType`:
  * @code{.cpp}
  * entt::DefaultRegistry registry;
- * entt::dependency<AType, AnotherType>(entt::break_op_t{}, registry.construction<MyType>());
+ * entt::dependency<AType, AnotherType>(entt::break_t{}, registry.construction<MyType>());
  * @endcode
  *
  * @tparam Dependency Types of components used to create the dependency.
@@ -73,7 +73,7 @@ void dependency(Sink<void(Registry<Entity> &, Entity)> sink) {
  * @param sink A sink object properly initialized.
  */
 template<typename... Dependency, typename Entity>
-void dependency(break_op_t, Sink<void(Registry<Entity> &, Entity)> sink) {
+void dependency(break_t, Sink<void(Registry<Entity> &, Entity)> sink) {
     sink.template disconnect<dependency<Entity, Dependency...>>();
 }
 

+ 11 - 11
src/entt/entity/registry.hpp

@@ -99,7 +99,7 @@ class Registry {
     }
 
     template<typename Tag>
-    void assure(tag_type_t) {
+    void assure(tag_t) {
         const auto ttype = tag_family::type<Tag>();
 
         if(!(ttype < tags.size())) {
@@ -147,7 +147,7 @@ public:
      * @return Runtime numeric identifier of the given type of tag.
      */
     template<typename Tag>
-    tag_type type(tag_type_t) const ENTT_NOEXCEPT {
+    tag_type type(tag_t) const ENTT_NOEXCEPT {
         return tag_family::type<Tag>();
     }
 
@@ -411,10 +411,10 @@ public:
      * @return A reference to the newly created tag.
      */
     template<typename Tag, typename... Args>
-    Tag & assign(tag_type_t, entity_type entity, Args &&... args) {
+    Tag & assign(tag_t, entity_type entity, Args &&... args) {
         assert(valid(entity));
         assert(!has<Tag>());
-        assure<Tag>(tag_type_t{});
+        assure<Tag>(tag_t{});
         auto &tup = tags[tag_family::type<Tag>()];
         std::get<0>(tup).reset(new Attaching<Tag>{entity, Tag{std::forward<Args>(args)...}});
         std::get<1>(tup).publish(*this, entity);
@@ -663,7 +663,7 @@ public:
      * @return A reference to the tag.
      */
     template<typename Tag, typename... Args>
-    Tag & replace(tag_type_t, Args &&... args) {
+    Tag & replace(tag_t, Args &&... args) {
         return (get<Tag>() = Tag{std::forward<Args>(args)...});
     }
 
@@ -791,8 +791,8 @@ public:
      * @return A temporary sink object.
      */
     template<typename Tag>
-    sink_type construction(tag_type_t) ENTT_NOEXCEPT {
-        assure<Tag>(tag_type_t{});
+    sink_type construction(tag_t) ENTT_NOEXCEPT {
+        assure<Tag>(tag_t{});
         return std::get<1>(tags[tag_family::type<Tag>()]).sink();
     }
 
@@ -849,8 +849,8 @@ public:
      * @return A temporary sink object.
      */
     template<typename Tag>
-    sink_type destruction(tag_type_t) ENTT_NOEXCEPT {
-        assure<Tag>(tag_type_t{});
+    sink_type destruction(tag_t) ENTT_NOEXCEPT {
+        assure<Tag>(tag_t{});
         return std::get<2>(tags[tag_family::type<Tag>()]).sink();
     }
 
@@ -1269,7 +1269,7 @@ public:
      * @return A newly created persistent view.
      */
     template<typename... Component>
-    PersistentView<Entity, Component...> persistent() {
+    PersistentView<Entity, Component...> view(persistent_t) {
         prepare<Component...>();
         const auto htype = handler_family::type<Component...>();
         return PersistentView<Entity, Component...>{*handlers[htype], (assure<Component>(), pool<Component>())...};
@@ -1298,7 +1298,7 @@ public:
      * @return A newly created raw view.
      */
     template<typename Component>
-    RawView<Entity, Component> raw() {
+    RawView<Entity, Component> view(raw_t) {
         assure<Component>();
         return RawView<Entity, Component>{pool<Component>()};
     }

+ 3 - 3
src/entt/entity/snapshot.hpp

@@ -315,7 +315,7 @@ public:
     template<typename... Tag, typename Archive>
     SnapshotLoader & tag(Archive &archive) {
         using accumulator_type = int[];
-        accumulator_type accumulator = { 0, (assign<Tag>(archive, tag_type_t{}), 0)... };
+        accumulator_type accumulator = { 0, (assign<Tag>(archive, tag_t{}), 0)... };
         (void)accumulator;
         return *this;
     }
@@ -464,7 +464,7 @@ class ContinuousLoader final {
 
         each(archive, [&archive, this](auto entity) {
             entity = restore(entity);
-            archive(registry.template assign<Tag>(tag_type_t{}, entity));
+            archive(registry.template assign<Tag>(tag_t{}, entity));
         });
     }
 
@@ -474,7 +474,7 @@ class ContinuousLoader final {
 
         each(archive, [&archive, member..., this](auto entity) {
             entity = restore(entity);
-            auto &tag = registry.template assign<Tag>(entt::tag_type_t{}, entity);
+            auto &tag = registry.template assign<Tag>(entt::tag_t{}, entity);
             archive(tag);
 
             using accumulator_type = int[];

+ 20 - 2
src/entt/entity/utility.hpp

@@ -11,7 +11,25 @@ namespace entt {
  * An empty class type used to disambiguate the overloads of some member
  * functions.
  */
-struct tag_type_t final {};
+struct tag_t final {};
+
+
+/**
+ * @brief Persistent view type.
+ *
+ * An empty class type used to disambiguate the overloads of some member
+ * functions.
+ */
+struct persistent_t final {};
+
+
+/**
+ * @brief Raw view type.
+ *
+ * An empty class type used to disambiguate the overloads of some member
+ * functions.
+ */
+struct raw_t final {};
 
 
 /**
@@ -20,7 +38,7 @@ struct tag_type_t final {};
  * An empty class type used to disambiguate the overloads of some member
  * functions.
  */
-struct break_op_t final {};
+struct break_t final {};
 
 
 }

+ 4 - 4
test/benchmark/benchmark.cpp

@@ -115,7 +115,7 @@ TEST(Benchmark, IterateSingleComponentRaw1M) {
     }
 
     Timer timer;
-    for(auto &&component: registry.raw<Position>()) {
+    for(auto &&component: registry.view<Position>(entt::raw_t{})) {
         (void)component;
     }
     timer.elapsed();
@@ -188,7 +188,7 @@ TEST(Benchmark, IterateTwoComponentsPersistent1M) {
     }
 
     Timer timer;
-    registry.persistent<Position, Velocity>().each([](auto, auto &...) {});
+    registry.view<Position, Velocity>(entt::persistent_t{}).each([](auto, auto &...) {});
     timer.elapsed();
 }
 
@@ -271,7 +271,7 @@ TEST(Benchmark, IterateFiveComponentsPersistent1M) {
     }
 
     Timer timer;
-    registry.persistent<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>().each([](auto, auto &...) {});
+    registry.view<Position, Velocity, Comp<1>, Comp<2>, Comp<3>>(entt::persistent_t{}).each([](auto, auto &...) {});
     timer.elapsed();
 }
 
@@ -374,7 +374,7 @@ TEST(Benchmark, IterateTenComponentsPersistent1M) {
     }
 
     Timer timer;
-    registry.persistent<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>().each([](auto, auto &...) {});
+    registry.view<Position, Velocity, Comp<1>, Comp<2>, Comp<3>, Comp<4>, Comp<5>, Comp<6>, Comp<7>, Comp<8>>(entt::persistent_t{}).each([](auto, auto &...) {});
     timer.elapsed();
 }
 

+ 7 - 7
test/entt/entity/actor.cpp

@@ -40,21 +40,21 @@ TEST(Actor, Tag) {
     ASSERT_EQ(&registry, &actor.registry());
     ASSERT_EQ(&registry, &cactor.registry());
     ASSERT_FALSE(registry.has<ActorTag>());
-    ASSERT_FALSE(actor.has<ActorTag>(entt::tag_type_t{}));
+    ASSERT_FALSE(actor.has<ActorTag>(entt::tag_t{}));
 
-    const auto &tag = actor.assign<ActorTag>(entt::tag_type_t{});
+    const auto &tag = actor.assign<ActorTag>(entt::tag_t{});
 
-    ASSERT_EQ(&tag, &actor.get<ActorTag>(entt::tag_type_t{}));
-    ASSERT_EQ(&tag, &cactor.get<ActorTag>(entt::tag_type_t{}));
+    ASSERT_EQ(&tag, &actor.get<ActorTag>(entt::tag_t{}));
+    ASSERT_EQ(&tag, &cactor.get<ActorTag>(entt::tag_t{}));
     ASSERT_TRUE(registry.has<ActorTag>());
     ASSERT_FALSE(registry.empty());
-    ASSERT_TRUE(actor.has<ActorTag>(entt::tag_type_t{}));
+    ASSERT_TRUE(actor.has<ActorTag>(entt::tag_t{}));
 
-    actor.remove<ActorTag>(entt::tag_type_t{});
+    actor.remove<ActorTag>(entt::tag_t{});
 
     ASSERT_FALSE(registry.has<ActorTag>());
     ASSERT_FALSE(registry.empty());
-    ASSERT_FALSE(actor.has<ActorTag>(entt::tag_type_t{}));
+    ASSERT_FALSE(actor.has<ActorTag>(entt::tag_t{}));
 }
 
 TEST(Actor, EntityLifetime) {

+ 1 - 1
test/entt/entity/helper.cpp

@@ -41,7 +41,7 @@ TEST(Dependency, Functionalities) {
     registry.remove<int>(entity);
     registry.remove<double>(entity);
     registry.remove<float>(entity);
-    entt::dependency<double, float>(entt::break_op_t{}, registry.construction<int>());
+    entt::dependency<double, float>(entt::break_t{}, registry.construction<int>());
     registry.assign<int>(entity);
 
     ASSERT_FALSE(registry.has<double>(entity));

+ 21 - 21
test/entt/entity/registry.cpp

@@ -48,11 +48,11 @@ struct Listener {
 TEST(DefaultRegistry, Types) {
     entt::DefaultRegistry registry;
 
-    ASSERT_EQ(registry.type<int>(entt::tag_type_t{}), registry.type<int>(entt::tag_type_t{}));
+    ASSERT_EQ(registry.type<int>(entt::tag_t{}), registry.type<int>(entt::tag_t{}));
     ASSERT_EQ(registry.type<int>(), registry.type<int>());
 
-    ASSERT_NE(registry.type<int>(entt::tag_type_t{}), registry.type<double>(entt::tag_type_t{}));
-    ASSERT_NE(registry.type<int>(), registry.type<double>(entt::tag_type_t{}));
+    ASSERT_NE(registry.type<int>(entt::tag_t{}), registry.type<double>(entt::tag_t{}));
+    ASSERT_NE(registry.type<int>(), registry.type<double>(entt::tag_t{}));
 }
 
 TEST(DefaultRegistry, Functionalities) {
@@ -287,7 +287,7 @@ TEST(DefaultRegistry, Orphans) {
     registry.create();
     registry.assign<int>(registry.create());
     registry.create();
-    registry.assign<double>(entt::tag_type_t{}, registry.create());
+    registry.assign<double>(entt::tag_t{}, registry.create());
 
     registry.orphans([&](auto) { ++tot; });
     ASSERT_EQ(tot, 2u);
@@ -341,14 +341,14 @@ TEST(DefaultRegistry, AttachSetRemoveTags) {
     ASSERT_FALSE(registry.has<int>());
 
     const auto entity = registry.create();
-    registry.assign<int>(entt::tag_type_t{}, entity, 42);
+    registry.assign<int>(entt::tag_t{}, entity, 42);
 
     ASSERT_TRUE(registry.has<int>());
     ASSERT_EQ(registry.get<int>(), 42);
     ASSERT_EQ(cregistry.get<int>(), 42);
     ASSERT_EQ(registry.attachee<int>(), entity);
 
-    registry.replace<int>(entt::tag_type_t{}, 3);
+    registry.replace<int>(entt::tag_t{}, 3);
 
     ASSERT_TRUE(registry.has<int>());
     ASSERT_EQ(registry.get<int>(), 3);
@@ -367,7 +367,7 @@ TEST(DefaultRegistry, AttachSetRemoveTags) {
 
     ASSERT_FALSE(registry.has<int>());
 
-    registry.assign<int>(entt::tag_type_t{}, entity, 42);
+    registry.assign<int>(entt::tag_t{}, entity, 42);
     registry.destroy(entity);
 
     ASSERT_FALSE(registry.has<int>());
@@ -401,7 +401,7 @@ TEST(DefaultRegistry, StandardViews) {
 
 TEST(DefaultRegistry, PersistentViews) {
     entt::DefaultRegistry registry;
-    auto view = registry.persistent<int, char>();
+    auto view = registry.view<int, char>(entt::persistent_t{});
 
     ASSERT_TRUE((registry.contains<int, char>()));
     ASSERT_FALSE((registry.contains<int, double>()));
@@ -433,7 +433,7 @@ TEST(DefaultRegistry, PersistentViews) {
 
 TEST(DefaultRegistry, RawViews) {
     entt::DefaultRegistry registry;
-    auto view = registry.raw<int>();
+    auto view = registry.view<int>(entt::raw_t{});
 
     const auto e0 = registry.create();
     registry.assign<int>(e0, 0);
@@ -463,7 +463,7 @@ TEST(DefaultRegistry, CleanStandardViewsAfterReset) {
 
 TEST(DefaultRegistry, CleanPersistentViewsAfterReset) {
     entt::DefaultRegistry registry;
-    auto view = registry.persistent<int, char>();
+    auto view = registry.view<int, char>(entt::persistent_t{});
 
     const auto entity = registry.create();
     registry.assign<int>(entity, 0);
@@ -478,7 +478,7 @@ TEST(DefaultRegistry, CleanPersistentViewsAfterReset) {
 
 TEST(DefaultRegistry, CleanRawViewsAfterReset) {
     entt::DefaultRegistry registry;
-    auto view = registry.raw<int>();
+    auto view = registry.view<int>(entt::raw_t{});
     registry.assign<int>(registry.create(), 0);
 
     ASSERT_EQ(view.size(), entt::DefaultRegistry::size_type{1});
@@ -491,7 +491,7 @@ TEST(DefaultRegistry, CleanRawViewsAfterReset) {
 TEST(DefaultRegistry, CleanTagsAfterReset) {
     entt::DefaultRegistry registry;
     const auto entity = registry.create();
-    registry.assign<int>(entt::tag_type_t{}, entity);
+    registry.assign<int>(entt::tag_t{}, entity);
 
     ASSERT_TRUE(registry.has<int>());
 
@@ -680,11 +680,11 @@ TEST(DefaultRegistry, TagSignals) {
     entt::DefaultRegistry registry;
     Listener listener;
 
-    registry.construction<int>(entt::tag_type_t{}).connect<Listener, &Listener::incrTag<int>>(&listener);
-    registry.destruction<int>(entt::tag_type_t{}).connect<Listener, &Listener::decrTag<int>>(&listener);
+    registry.construction<int>(entt::tag_t{}).connect<Listener, &Listener::incrTag<int>>(&listener);
+    registry.destruction<int>(entt::tag_t{}).connect<Listener, &Listener::decrTag<int>>(&listener);
 
     auto e0 = registry.create();
-    registry.assign<int>(entt::tag_type_t{}, e0);
+    registry.assign<int>(entt::tag_t{}, e0);
 
     ASSERT_EQ(listener.counter, 1);
     ASSERT_EQ(listener.last, e0);
@@ -696,18 +696,18 @@ TEST(DefaultRegistry, TagSignals) {
     ASSERT_EQ(listener.counter, 0);
     ASSERT_EQ(listener.last, e1);
 
-    registry.construction<int>(entt::tag_type_t{}).disconnect<Listener, &Listener::incrTag<int>>(&listener);
-    registry.destruction<int>(entt::tag_type_t{}).disconnect<Listener, &Listener::decrTag<int>>(&listener);
-    registry.assign<int>(entt::tag_type_t{}, e0);
+    registry.construction<int>(entt::tag_t{}).disconnect<Listener, &Listener::incrTag<int>>(&listener);
+    registry.destruction<int>(entt::tag_t{}).disconnect<Listener, &Listener::decrTag<int>>(&listener);
+    registry.assign<int>(entt::tag_t{}, e0);
     registry.remove<int>();
 
     ASSERT_EQ(listener.counter, 0);
     ASSERT_EQ(listener.last, e1);
 
-    registry.construction<int>(entt::tag_type_t{}).connect<Listener, &Listener::incrTag<int>>(&listener);
-    registry.destruction<int>(entt::tag_type_t{}).connect<Listener, &Listener::decrTag<int>>(&listener);
+    registry.construction<int>(entt::tag_t{}).connect<Listener, &Listener::incrTag<int>>(&listener);
+    registry.destruction<int>(entt::tag_t{}).connect<Listener, &Listener::decrTag<int>>(&listener);
 
-    registry.assign<int>(entt::tag_type_t{}, e0);
+    registry.assign<int>(entt::tag_t{}, e0);
     registry.destroy(e0);
 
     ASSERT_EQ(listener.counter, 0);

+ 6 - 6
test/entt/entity/snapshot.cpp

@@ -63,10 +63,10 @@ TEST(Snapshot, Dump) {
 
     const auto e3 = registry.create();
     registry.assign<char>(e3, '0');
-    registry.assign<float>(entt::tag_type_t{}, e3, .3f);
+    registry.assign<float>(entt::tag_t{}, e3, .3f);
 
     const auto e4 = registry.create();
-    registry.assign<AComponent>(entt::tag_type_t{}, e4);
+    registry.assign<AComponent>(entt::tag_t{}, e4);
 
     registry.destroy(e1);
     auto v1 = registry.current(e1);
@@ -152,10 +152,10 @@ TEST(Snapshot, Partial) {
 
     const auto e3 = registry.create();
     registry.assign<char>(e3, '0');
-    registry.assign<float>(entt::tag_type_t{}, e3, .3f);
+    registry.assign<float>(entt::tag_t{}, e3, .3f);
 
     const auto e4 = registry.create();
-    registry.assign<AComponent>(entt::tag_type_t{}, e4);
+    registry.assign<AComponent>(entt::tag_t{}, e4);
 
     registry.destroy(e1);
     auto v1 = registry.current(e1);
@@ -279,7 +279,7 @@ TEST(Snapshot, Continuous) {
         if(i % 2) {
             src.assign<WhatAComponent>(entity, entity);
         } else if(i == 2) {
-            src.assign<double>(entt::tag_type_t{}, entity, .3);
+            src.assign<double>(entt::tag_t{}, entity, .3);
         }
     }
 
@@ -511,7 +511,7 @@ TEST(Snapshot, SyncDataMembers) {
     auto parent = src.create();
     auto child = src.create();
 
-    src.assign<WhatAComponent>(entt::tag_type_t{}, child, parent).quux.push_back(parent);
+    src.assign<WhatAComponent>(entt::tag_t{}, child, parent).quux.push_back(parent);
     src.assign<WhatAComponent>(child, child).quux.push_back(child);
 
     src.snapshot().entities(output)

+ 18 - 18
test/entt/entity/view.cpp

@@ -280,7 +280,7 @@ TEST(View, MultipleComponentEach) {
 TEST(PersistentView, Prepare) {
     entt::DefaultRegistry registry;
     registry.prepare<int, char>();
-    auto view = registry.persistent<int, char>();
+    auto view = registry.view<int, char>(entt::persistent_t{});
 
     ASSERT_TRUE(view.empty());
 
@@ -292,8 +292,8 @@ TEST(PersistentView, Prepare) {
     registry.assign<char>(e1);
 
     ASSERT_FALSE(view.empty());
-    ASSERT_NO_THROW((registry.persistent<int, char>().begin()++));
-    ASSERT_NO_THROW((++registry.persistent<int, char>().begin()));
+    ASSERT_NO_THROW((registry.view<int, char>(entt::persistent_t{}).begin()++));
+    ASSERT_NO_THROW((++registry.view<int, char>(entt::persistent_t{}).begin()));
 
     ASSERT_NE(view.begin(), view.end());
     ASSERT_EQ(view.size(), typename decltype(view)::size_type{1});
@@ -328,7 +328,7 @@ TEST(PersistentView, Prepare) {
 
 TEST(PersistentView, NoPrepare) {
     entt::DefaultRegistry registry;
-    auto view = registry.persistent<int, char>();
+    auto view = registry.view<int, char>(entt::persistent_t{});
 
     ASSERT_TRUE(view.empty());
 
@@ -340,8 +340,8 @@ TEST(PersistentView, NoPrepare) {
     registry.assign<char>(e1);
 
     ASSERT_FALSE(view.empty());
-    ASSERT_NO_THROW((registry.persistent<int, char>().begin()++));
-    ASSERT_NO_THROW((++registry.persistent<int, char>().begin()));
+    ASSERT_NO_THROW((registry.view<int, char>(entt::persistent_t{}).begin()++));
+    ASSERT_NO_THROW((++registry.view<int, char>(entt::persistent_t{}).begin()));
 
     ASSERT_NE(view.begin(), view.end());
     ASSERT_EQ(view.size(), typename decltype(view)::size_type{1});
@@ -376,7 +376,7 @@ TEST(PersistentView, NoPrepare) {
 
 TEST(PersistentView, BeginEnd) {
     entt::DefaultRegistry registry;
-    auto view = registry.persistent<int, char>();
+    auto view = registry.view<int, char>(entt::persistent_t{});
 
     for(auto i = 0; i < 3; ++i) {
         const auto entity = registry.create();
@@ -420,7 +420,7 @@ TEST(PersistentView, Contains) {
 
     registry.destroy(e0);
 
-    auto view = registry.persistent<int, char>();
+    auto view = registry.view<int, char>(entt::persistent_t{});
 
     ASSERT_FALSE(view.contains(e0));
     ASSERT_TRUE(view.contains(e1));
@@ -438,12 +438,12 @@ TEST(PersistentView, Empty) {
     registry.assign<char>(e1);
     registry.assign<float>(e1);
 
-    for(auto entity: registry.persistent<char, int, float>()) {
+    for(auto entity: registry.view<char, int, float>(entt::persistent_t{})) {
         (void)entity;
         FAIL();
     }
 
-    for(auto entity: registry.persistent<double, char, int, float>()) {
+    for(auto entity: registry.view<double, char, int, float>(entt::persistent_t{})) {
         (void)entity;
         FAIL();
     }
@@ -461,7 +461,7 @@ TEST(PersistentView, Each) {
     registry.assign<int>(e1);
     registry.assign<char>(e1);
 
-    auto view = registry.persistent<int, char>();
+    auto view = registry.view<int, char>(entt::persistent_t{});
     const auto &cview = static_cast<const decltype(view) &>(view);
     std::size_t cnt = 0;
 
@@ -493,7 +493,7 @@ TEST(PersistentView, Sort) {
     registry.assign<int>(e1, ival++);
     registry.assign<int>(e2, ival++);
 
-    auto view = registry.persistent<int, unsigned int>();
+    auto view = registry.view<int, unsigned int>(entt::persistent_t{});
 
     for(auto entity: view) {
         ASSERT_EQ(view.get<unsigned int>(entity), --uval);
@@ -511,7 +511,7 @@ TEST(PersistentView, Sort) {
 
 TEST(RawView, Functionalities) {
     entt::DefaultRegistry registry;
-    auto view = registry.raw<char>();
+    auto view = registry.view<char>(entt::raw_t{});
 
     ASSERT_TRUE(view.empty());
 
@@ -522,8 +522,8 @@ TEST(RawView, Functionalities) {
     registry.assign<char>(e1);
 
     ASSERT_FALSE(view.empty());
-    ASSERT_NO_THROW(registry.raw<char>().begin()++);
-    ASSERT_NO_THROW(++registry.raw<char>().begin());
+    ASSERT_NO_THROW(registry.view<char>(entt::raw_t{}).begin()++);
+    ASSERT_NO_THROW(++registry.view<char>(entt::raw_t{}).begin());
 
     ASSERT_NE(view.begin(), view.end());
     ASSERT_EQ(view.size(), typename decltype(view)::size_type{1});
@@ -563,7 +563,7 @@ TEST(RawView, Functionalities) {
 
 TEST(RawView, BeginEnd) {
     entt::DefaultRegistry registry;
-    auto view = registry.raw<int>();
+    auto view = registry.view<int>(entt::raw_t{});
 
     for(auto i = 0; i < 3; ++i) {
         registry.assign<int>(registry.create());
@@ -602,7 +602,7 @@ TEST(RawView, Empty) {
     const auto e1 = registry.create();
     registry.assign<char>(e1);
 
-    auto view = registry.raw<int>();
+    auto view = registry.view<int>(entt::raw_t{});
 
     ASSERT_EQ(view.size(), entt::DefaultRegistry::size_type{0});
 
@@ -618,7 +618,7 @@ TEST(RawView, Each) {
     registry.assign<int>(registry.create(), 1);
     registry.assign<int>(registry.create(), 3);
 
-    auto view = registry.raw<int>();
+    auto view = registry.view<int>(entt::raw_t{});
     const auto &cview = static_cast<const decltype(view) &>(view);
     std::size_t cnt = 0;