Quellcode durchsuchen

storage: drop deprecated member pack

Michele Caini vor 2 Jahren
Ursprung
Commit
9e9bed06af
2 geänderte Dateien mit 11 neuen und 25 gelöschten Zeilen
  1. 0 13
      src/entt/entity/storage.hpp
  2. 11 12
      test/entt/entity/storage_entity.cpp

+ 0 - 13
src/entt/entity/storage.hpp

@@ -1123,19 +1123,6 @@ public:
         }
     }
 
-    /**
-     * @brief Makes all elements in a range contiguous.
-     * @tparam It Type of forward iterator.
-     * @param first An iterator to the first element of the range to pack.
-     * @param last An iterator past the last element of the range to pack.
-     * @return The number of elements within the newly created range.
-     */
-    template<typename It>
-    [[deprecated("use sort_as instead")]] size_type pack(It first, It last) {
-        base_type::sort_as(first, last);
-        return static_cast<size_type>(std::distance(first, last));
-    }
-
     /**
      * @brief Returns an iterable object to use to _visit_ a storage.
      *

+ 11 - 12
test/entt/entity/storage_entity.cpp

@@ -272,22 +272,21 @@ TEST(StorageEntity, Pack) {
     pool.push(entity.begin(), entity.end());
     std::swap(entity[0u], entity[1u]);
 
-    const auto len = pool.pack(entity.begin() + 1u, entity.end()); // NOLINT
-    auto it = pool.each().cbegin().base();
+    const auto to = pool.sort_as(entity.begin() + 1u, entity.end());
+    auto from = pool.each().cbegin().base();
 
-    ASSERT_NE(it, pool.cbegin());
-    ASSERT_NE(it, pool.cend());
+    ASSERT_NE(from, pool.cbegin());
+    ASSERT_NE(from, pool.cend());
 
-    ASSERT_EQ(len, 2u);
-    ASSERT_NE(it + len, pool.cend());
-    ASSERT_EQ(it + len + 1u, pool.cend());
+    ASSERT_NE(to, pool.cend());
+    ASSERT_EQ(to + 1u, pool.cend());
 
-    ASSERT_EQ(*it++, entity[1u]);
-    ASSERT_EQ(*it++, entity[2u]);
+    ASSERT_EQ(*from++, entity[1u]);
+    ASSERT_EQ(*from++, entity[2u]);
 
-    ASSERT_NE(it, pool.cend());
-    ASSERT_EQ(*it++, entity[0u]);
-    ASSERT_EQ(it, pool.cend());
+    ASSERT_NE(from, pool.cend());
+    ASSERT_EQ(*from++, entity[0u]);
+    ASSERT_EQ(from, pool.cend());
 }
 
 TEST(StorageEntity, FreeList) {