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

sparse_set: remove copy ctor/assignment operator (use range-construct instead)

Michele Caini 6 лет назад
Родитель
Сommit
8d4b5f4bb7
4 измененных файлов с 0 добавлено и 41 удалено
  1. 0 2
      TODO
  2. 0 2
      src/entt/entity/registry.hpp
  3. 0 29
      src/entt/entity/sparse_set.hpp
  4. 0 8
      test/entt/entity/sparse_set.cpp

+ 0 - 2
TODO

@@ -9,7 +9,6 @@
 * add examples (and credits) from @alanjfs :)
 * static reflection, hint: template<> meta_type_t<Type>: meta_descriptor<name, func..., props..., etc...> (see #342)
 * observer: user defined filters (eg .replace<T, &function> or .group<T, U, &func>)
-* use underlying_type as entity type within pools and registry? it would make different registries work together flawlessy
 * can we write a bool conv func for entt::entity that silently compares it to null?
 * reset... reset everywhere...
 * is it possible to make 0 the entity null?
@@ -17,7 +16,6 @@
 * any-of rule for views/groups (eg entity has A and any of B/C/D)
   - get -> all, exclude -> none
 * review prepare after clone and the others have been removed
-* remove copy-ctor/op from sparse set and storage (it doesn't make much sense)
 
 * WIP:
  - deprecate snapshot, loader, ...

+ 0 - 2
src/entt/entity/registry.hpp

@@ -47,8 +47,6 @@ class basic_registry {
         static_assert(std::is_same_v<Component, std::decay_t<Component>>);
         std::size_t super{};
 
-        using storage<Entity, Component>::storage;
-
         auto on_construct() ENTT_NOEXCEPT {
             return sink{construction};
         }

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

@@ -186,41 +186,12 @@ public:
     /*! @brief Default constructor. */
     sparse_set() = default;
 
-    /**
-     * @brief Copy constructor.
-     * @param other The instance to copy from.
-     */
-    sparse_set(const sparse_set &other)
-        : reverse{},
-          direct{other.direct}
-    {
-        for(size_type pos{}, last = other.reverse.size(); pos < last; ++pos) {
-            if(other.reverse[pos]) {
-                std::copy_n(other.reverse[pos].get(), entt_per_page, assure(pos));
-            }
-        }
-    }
-
     /*! @brief Default move constructor. */
     sparse_set(sparse_set &&) = default;
 
     /*! @brief Default destructor. */
     virtual ~sparse_set() = default;
 
-    /**
-     * @brief Copy assignment operator.
-     * @param other The instance to copy from.
-     * @return This sparse set.
-     */
-    sparse_set & operator=(const sparse_set &other) {
-        if(&other != this) {
-            auto tmp{other};
-            *this = std::move(tmp);
-        }
-
-        return *this;
-    }
-
     /*! @brief Default move assignment operator. @return This sparse set. */
     sparse_set & operator=(sparse_set &&) = default;
 

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

@@ -53,14 +53,6 @@ TEST(SparseSet, Functionalities) {
     ASSERT_TRUE(std::is_move_constructible_v<decltype(set)>);
     ASSERT_TRUE(std::is_move_assignable_v<decltype(set)>);
 
-    entt::sparse_set<entt::entity> cpy{set};
-    set = cpy;
-
-    ASSERT_FALSE(set.empty());
-    ASSERT_FALSE(cpy.empty());
-    ASSERT_EQ(set.index(entt::entity{42}), 0u);
-    ASSERT_EQ(cpy.index(entt::entity{42}), 0u);
-
     entt::sparse_set<entt::entity> other{std::move(set)};
 
     set = std::move(other);