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

This commit is contained in:
Michele Caini
2020-02-27 13:00:03 +01:00
parent 9eb5a85e9e
commit 8d4b5f4bb7
4 changed files with 0 additions and 41 deletions

2
TODO
View File

@@ -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, ...

View File

@@ -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};
}

View File

@@ -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;

View File

@@ -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);