sparse_set: prepare for detached pools

This commit is contained in:
Michele Caini
2021-02-02 12:59:07 +01:00
parent ab907e4fef
commit 0fcf0142ba
2 changed files with 3 additions and 15 deletions

View File

@@ -175,7 +175,6 @@ class basic_sparse_set {
virtual void swap_at(const std::size_t, const std::size_t) {}
virtual void swap_and_pop(const std::size_t) {}
virtual void clear_all() {}
public:
/*! @brief Underlying entity identifier. */
@@ -443,13 +442,8 @@ public:
*/
template<typename It>
void remove(It first, It last) {
if(std::distance(first, last) == std::distance(packed.begin(), packed.end())) {
// no validity check, let it be misused
clear();
} else {
for(; first != last; ++first) {
remove(*first);
}
for(; first != last; ++first) {
remove(*first);
}
}
@@ -577,9 +571,7 @@ public:
/*! @brief Clears a sparse set. */
void clear() ENTT_NOEXCEPT {
sparse.clear();
packed.clear();
clear_all();
remove(rbegin(), rend());
}
private:

View File

@@ -174,10 +174,6 @@ class basic_storage: public basic_sparse_set<Entity> {
instances.pop_back();
}
void clear_all() ENTT_NOEXCEPT final {
instances.clear();
}
public:
/*! @brief Type of the objects associated with the entities. */
using value_type = Type;