|
@@ -132,6 +132,11 @@ template<typename Container>
|
|
|
return !(lhs < rhs);
|
|
return !(lhs < rhs);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+template<typename Type>
|
|
|
|
|
+auto policy_to_head(const Type mask, const deletion_policy mode) noexcept {
|
|
|
|
|
+ return mask * (mode != deletion_policy::swap_only);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
} // namespace internal
|
|
} // namespace internal
|
|
|
/*! @endcond */
|
|
/*! @endcond */
|
|
|
|
|
|
|
@@ -218,10 +223,6 @@ class basic_sparse_set {
|
|
|
std::swap(lhs, rhs);
|
|
std::swap(lhs, rhs);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- underlying_type policy_to_head() const noexcept {
|
|
|
|
|
- return traits_type::entity_mask * (mode != deletion_policy::swap_only);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
private:
|
|
private:
|
|
|
virtual const void *get_at(const std::size_t) const {
|
|
virtual const void *get_at(const std::size_t) const {
|
|
|
return nullptr;
|
|
return nullptr;
|
|
@@ -320,7 +321,7 @@ protected:
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- head = policy_to_head();
|
|
|
|
|
|
|
+ head = internal::policy_to_head(traits_type::entity_mask, mode);
|
|
|
packed.clear();
|
|
packed.clear();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -420,7 +421,7 @@ public:
|
|
|
packed{allocator},
|
|
packed{allocator},
|
|
|
info{&elem},
|
|
info{&elem},
|
|
|
mode{pol},
|
|
mode{pol},
|
|
|
- head{policy_to_head()} {
|
|
|
|
|
|
|
+ head{internal::policy_to_head(traits_type::entity_mask, mode)} {
|
|
|
ENTT_ASSERT(traits_type::version_mask || mode != deletion_policy::in_place, "Policy does not support zero-sized versions");
|
|
ENTT_ASSERT(traits_type::version_mask || mode != deletion_policy::in_place, "Policy does not support zero-sized versions");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -433,7 +434,7 @@ public:
|
|
|
packed{std::move(other.packed)},
|
|
packed{std::move(other.packed)},
|
|
|
info{other.info},
|
|
info{other.info},
|
|
|
mode{other.mode},
|
|
mode{other.mode},
|
|
|
- head{std::exchange(other.head, policy_to_head())} {}
|
|
|
|
|
|
|
+ head{std::exchange(other.head, internal::policy_to_head(traits_type::entity_mask, mode))} {}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @brief Allocator-extended move constructor.
|
|
* @brief Allocator-extended move constructor.
|
|
@@ -445,7 +446,7 @@ public:
|
|
|
packed{std::move(other.packed), allocator},
|
|
packed{std::move(other.packed), allocator},
|
|
|
info{other.info},
|
|
info{other.info},
|
|
|
mode{other.mode},
|
|
mode{other.mode},
|
|
|
- head{std::exchange(other.head, policy_to_head())} {
|
|
|
|
|
|
|
+ head{std::exchange(other.head, internal::policy_to_head(traits_type::entity_mask, mode))} {
|
|
|
ENTT_ASSERT(alloc_traits::is_always_equal::value || packed.get_allocator() == other.packed.get_allocator(), "Copying a sparse set is not allowed");
|
|
ENTT_ASSERT(alloc_traits::is_always_equal::value || packed.get_allocator() == other.packed.get_allocator(), "Copying a sparse set is not allowed");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -467,7 +468,7 @@ public:
|
|
|
packed = std::move(other.packed);
|
|
packed = std::move(other.packed);
|
|
|
info = other.info;
|
|
info = other.info;
|
|
|
mode = other.mode;
|
|
mode = other.mode;
|
|
|
- head = std::exchange(other.head, policy_to_head());
|
|
|
|
|
|
|
+ head = std::exchange(other.head, internal::policy_to_head(traits_type::entity_mask, mode));
|
|
|
return *this;
|
|
return *this;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1064,7 +1065,7 @@ public:
|
|
|
pop_all();
|
|
pop_all();
|
|
|
// sanity check to avoid subtle issues due to storage classes
|
|
// sanity check to avoid subtle issues due to storage classes
|
|
|
ENTT_ASSERT((compact(), size()) == 0u, "Non-empty set");
|
|
ENTT_ASSERT((compact(), size()) == 0u, "Non-empty set");
|
|
|
- head = policy_to_head();
|
|
|
|
|
|
|
+ head = internal::policy_to_head(traits_type::entity_mask, mode);
|
|
|
packed.clear();
|
|
packed.clear();
|
|
|
}
|
|
}
|
|
|
|
|
|