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

sparse_set: drop deprecated member at

Michele Caini 2 лет назад
Родитель
Сommit
e3cb863f94
2 измененных файлов с 4 добавлено и 24 удалено
  1. 0 9
      src/entt/entity/sparse_set.hpp
  2. 4 15
      test/entt/entity/sparse_set.cpp

+ 0 - 9
src/entt/entity/sparse_set.hpp

@@ -749,15 +749,6 @@ public:
         return static_cast<size_type>(traits_type::to_entity(sparse_ref(entt)));
     }
 
-    /**
-     * @brief Returns the entity at specified location, with bounds checking.
-     * @param pos The position for which to return the entity.
-     * @return The entity at specified location if any, a null entity otherwise.
-     */
-    [[deprecated("use .begin()[pos] instead")]] [[nodiscard]] entity_type at(const size_type pos) const noexcept {
-        return pos < packed.size() ? packed[pos] : null;
-    }
-
     /**
      * @brief Returns the entity at specified location, without bounds checking.
      * @param pos The position for which to return the entity.

+ 4 - 15
test/entt/entity/sparse_set.cpp

@@ -951,23 +951,12 @@ TYPED_TEST(SparseSet, Indexing) {
     for(const auto policy: this->deletion_policy) {
         sparse_set_type set{policy};
 
-        ASSERT_EQ(set.size(), 0u);
-
-        ASSERT_EQ(set.at(0u), static_cast<entity_type>(entt::null)); // NOLINT
-        ASSERT_EQ(set.at(3u), static_cast<entity_type>(entt::null)); // NOLINT
-
-        const entity_type entity{1};
-        const entity_type other{2};
+        const std::array entity{entity_type{1}, entity_type{2}};
 
-        set.push(entity);
-        set.push(other);
-
-        ASSERT_EQ(set.size(), 2u);
-
-        ASSERT_EQ(set.at(0u), entity); // NOLINT
-        ASSERT_EQ(set.at(1u), other);  // NOLINT
+        set.push(entity.begin(), entity.end());
 
-        ASSERT_EQ(set.at(2u), static_cast<entity_type>(entt::null)); // NOLINT
+        ASSERT_EQ(set[0u], entity[0u]);
+        ASSERT_EQ(set[1u], entity[1u]);
     }
 }