Browse Source

helper: drop deprecated function to_entity

Michele Caini 2 years ago
parent
commit
7d0cf207fd
2 changed files with 2 additions and 23 deletions
  1. 0 17
      src/entt/entity/helper.hpp
  2. 2 6
      test/entt/entity/helper.cpp

+ 0 - 17
src/entt/entity/helper.hpp

@@ -139,23 +139,6 @@ auto to_entity(const basic_storage<Args...> &storage, const typename basic_stora
     return null;
 }
 
-/**
- * @copybrief to_entity
- * @tparam Args Registry type template parameters.
- * @tparam Component Type of component.
- * @param reg A registry that contains the given entity and its components.
- * @param instance A valid component instance.
- * @return The entity associated with the given component.
- */
-template<typename... Args, typename Component>
-[[deprecated("use storage based to_entity instead")]] typename basic_registry<Args...>::entity_type to_entity(const basic_registry<Args...> &reg, const Component &instance) {
-    if(const auto *storage = reg.template storage<Component>(); storage) {
-        return to_entity(*storage, instance);
-    }
-
-    return null;
-}
-
 /*! @brief Primary template isn't defined on purpose. */
 template<typename...>
 struct sigh_helper;

+ 2 - 6
test/entt/entity/helper.cpp

@@ -67,13 +67,10 @@ TYPED_TEST(ToEntity, Functionalities) {
     entt::registry registry;
     const entt::entity null = entt::null;
 
-    ASSERT_EQ(entt::to_entity(registry, value_type{42}), null); // NOLINT
-
     auto &storage = registry.storage<value_type>();
     constexpr auto page_size = entt::storage_type_t<value_type>::traits_type::page_size;
-    const value_type value{42};
+    const value_type value{4};
 
-    ASSERT_EQ(entt::to_entity(registry, value_type{42}), null); // NOLINT
     ASSERT_EQ(entt::to_entity(storage, value), null);
 
     const auto entity = registry.create();
@@ -89,7 +86,7 @@ TYPED_TEST(ToEntity, Functionalities) {
     registry.emplace<value_type>(other);
     registry.emplace<value_type>(next);
 
-    ASSERT_EQ(entt::to_entity(registry, registry.get<value_type>(entity)), entity); // NOLINT
+    ASSERT_EQ(entt::to_entity(storage, registry.get<value_type>(entity)), entity);
     ASSERT_EQ(entt::to_entity(storage, registry.get<value_type>(other)), other);
     ASSERT_EQ(entt::to_entity(storage, registry.get<value_type>(next)), next);
 
@@ -102,7 +99,6 @@ TYPED_TEST(ToEntity, Functionalities) {
 
     ASSERT_EQ(&registry.get<value_type>(entity) + page_size - 1u, &registry.get<value_type>(next)); // NOLINT
 
-    ASSERT_EQ(entt::to_entity(storage, value_type{42}), null);
     ASSERT_EQ(entt::to_entity(storage, value), null);
 }