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

registry: drop ::data (deprecated function)

Michele Caini 2 лет назад
Родитель
Сommit
0fec57e76d
2 измененных файлов с 1 добавлено и 35 удалено
  1. 0 16
      src/entt/entity/registry.hpp
  2. 1 19
      test/entt/entity/registry.cpp

+ 0 - 16
src/entt/entity/registry.hpp

@@ -456,22 +456,6 @@ public:
         return assure<Type>(id);
     }
 
-    /**
-     * @brief Direct access to the list of entities of a registry.
-     *
-     * The returned pointer is such that range `[data(), data() + size())` is
-     * always a valid range, even if the registry is empty.
-     *
-     * @warning
-     * This list contains both valid and destroyed entities and isn't suitable
-     * for direct use.
-     *
-     * @return A pointer to the array of entities.
-     */
-    [[deprecated("use .storage<Entity>().data() instead")]] [[nodiscard]] const entity_type *data() const noexcept {
-        return entities.data();
-    }
-
     /**
      * @brief Returns the number of released entities.
      * @return The number of released entities.

+ 1 - 19
test/entt/entity/registry.cpp

@@ -496,24 +496,6 @@ TEST(Registry, Identifiers) {
     ASSERT_EQ(registry.current(invalid), traits_type::to_version(entt::tombstone));
 }
 
-TEST(Registry, Data) {
-    using traits_type = entt::entt_traits<entt::entity>;
-
-    entt::registry registry;
-
-    ASSERT_EQ(std::as_const(registry).data(), nullptr);
-
-    const auto entity = registry.create();
-
-    ASSERT_EQ(*std::as_const(registry).data(), entity);
-
-    const auto other = registry.create();
-    registry.release(entity);
-
-    ASSERT_EQ(*std::as_const(registry).data(), other);
-    ASSERT_EQ(*(std::as_const(registry).data() + 1u), traits_type::next(entity));
-}
-
 TEST(Registry, CreateManyEntitiesAtOnce) {
     using traits_type = entt::entt_traits<entt::entity>;
 
@@ -2067,7 +2049,7 @@ TEST(Registry, AssignEntities) {
     registry.release(entities[2]);
 
     entt::registry other;
-    const auto *data = registry.data();
+    const auto *data = registry.storage<entt::entity>().data();
     other.assign(data, data + registry.storage<entt::entity>().size(), registry.released());
 
     ASSERT_EQ(registry.storage<entt::entity>().size(), other.storage<entt::entity>().size());