Переглянути джерело

sparse_set: drop scoped iterators

Michele Caini 1 рік тому
батько
коміт
1be0175a18
2 змінених файлів з 0 додано та 120 видалено
  1. 0 40
      src/entt/entity/sparse_set.hpp
  2. 0 80
      test/entt/entity/sparse_set.cpp

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

@@ -659,46 +659,6 @@ public:
         return rend();
     }
 
-    /*! @copydoc begin Useful only in case of swap-only policy. */
-    [[nodiscard]] iterator begin(int) const noexcept {
-        return (mode == deletion_policy::swap_only) ? (end() - static_cast<typename iterator::difference_type>(head)) : begin();
-    }
-
-    /*! @copydoc cbegin Useful only in case of swap-only policy. */
-    [[nodiscard]] const_iterator cbegin(int) const noexcept {
-        return begin(0);
-    }
-
-    /*! @copydoc end Useful only in case of swap-only policy. */
-    [[nodiscard]] iterator end(int) const noexcept {
-        return end();
-    }
-
-    /*! @copydoc cend Useful only in case of swap-only policy. */
-    [[nodiscard]] const_iterator cend(int) const noexcept {
-        return end();
-    }
-
-    /*! @copydoc rbegin Useful only in case of swap-only policy. */
-    [[nodiscard]] reverse_iterator rbegin(int) const noexcept {
-        return std::make_reverse_iterator(end());
-    }
-
-    /*! @copydoc rbegin Useful only in case of swap-only policy. */
-    [[nodiscard]] const_reverse_iterator crbegin(int) const noexcept {
-        return rbegin();
-    }
-
-    /*! @copydoc rbegin Useful only in case of swap-only policy. */
-    [[nodiscard]] reverse_iterator rend(int) const noexcept {
-        return std::make_reverse_iterator(begin(0));
-    }
-
-    /*! @copydoc rbegin Useful only in case of swap-only policy. */
-    [[nodiscard]] const_reverse_iterator crend(int) const noexcept {
-        return rend(0);
-    }
-
     /**
      * @brief Finds an entity.
      * @param entt A valid identifier.

+ 0 - 80
test/entt/entity/sparse_set.cpp

@@ -590,86 +590,6 @@ TYPED_TEST(SparseSet, ReverseIterator) {
     }
 }
 
-TYPED_TEST(SparseSet, ScopedIterator) {
-    using entity_type = typename TestFixture::type;
-    using sparse_set_type = entt::basic_sparse_set<entity_type>;
-
-    for(const auto policy: this->deletion_policy) {
-        sparse_set_type set{policy};
-
-        const entity_type entity{1};
-        const entity_type other{2};
-
-        set.push(entity);
-        set.push(other);
-        set.erase(entity);
-
-        switch(policy) {
-        case entt::deletion_policy::swap_and_pop:
-        case entt::deletion_policy::in_place: {
-            ASSERT_NE(set.begin(), set.end());
-            ASSERT_NE(set.cbegin(), set.cend());
-        } break;
-        case entt::deletion_policy::swap_only: {
-            ASSERT_NE(set.begin(), set.begin(0));
-            ASSERT_EQ(set.begin() + 1, set.begin(0));
-            ASSERT_NE(set.cbegin(0), set.cend());
-
-            set.free_list(0);
-
-            ASSERT_NE(set.begin(), set.begin(0));
-            ASSERT_EQ(set.begin() + 2, set.begin(0));
-            ASSERT_EQ(set.cbegin(0), set.cend());
-
-            set.free_list(2);
-
-            ASSERT_EQ(set.begin(), set.begin(0));
-            ASSERT_NE(set.cbegin(0), set.cend());
-        } break;
-        }
-    }
-}
-
-TYPED_TEST(SparseSet, ScopedReverseIterator) {
-    using entity_type = typename TestFixture::type;
-    using sparse_set_type = entt::basic_sparse_set<entity_type>;
-
-    for(const auto policy: this->deletion_policy) {
-        sparse_set_type set{policy};
-
-        const entity_type entity{1};
-        const entity_type other{2};
-
-        set.push(entity);
-        set.push(other);
-        set.erase(entity);
-
-        switch(policy) {
-        case entt::deletion_policy::swap_and_pop:
-        case entt::deletion_policy::in_place: {
-            ASSERT_NE(set.rbegin(), set.rend());
-            ASSERT_NE(set.crbegin(), set.crend());
-        } break;
-        case entt::deletion_policy::swap_only: {
-            ASSERT_NE(set.rend(), set.rend(0));
-            ASSERT_EQ(set.rend() - 1, set.rend(0));
-            ASSERT_NE(set.crbegin(), set.crend(0));
-
-            set.free_list(0);
-
-            ASSERT_NE(set.rend(), set.rend(0));
-            ASSERT_EQ(set.rend() - 2, set.rend(0));
-            ASSERT_EQ(set.crbegin(), set.crend(0));
-
-            set.free_list(2);
-
-            ASSERT_EQ(set.rend(), set.rend(0));
-            ASSERT_NE(set.crbegin(), set.crend(0));
-        } break;
-        }
-    }
-}
-
 TYPED_TEST(SparseSet, Find) {
     using entity_type = typename TestFixture::type;
     using sparse_set_type = entt::basic_sparse_set<entity_type>;