registry: drop ::data (deprecated function)

This commit is contained in:
Michele Caini
2023-06-17 22:42:55 +02:00
parent e72bf9acb1
commit 0fec57e76d
2 changed files with 1 additions and 35 deletions

View File

@@ -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.

View File

@@ -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());