entity: internal changes/cleanup

This commit is contained in:
Michele Caini
2022-04-05 08:42:36 +02:00
parent 436b2b3140
commit f1f47ee44a
2 changed files with 11 additions and 11 deletions

View File

@@ -20,9 +20,9 @@ namespace entt {
namespace internal {
template<typename Type>
template<typename Set>
class runtime_view_iterator final {
using iterator_type = typename Type::iterator;
using iterator_type = typename Set::iterator;
[[nodiscard]] bool valid() const {
return (!tombstone_check || *it != tombstone)
@@ -43,7 +43,7 @@ public:
it{},
tombstone_check{} {}
runtime_view_iterator(const std::vector<const Type *> &cpools, const std::vector<const Type *> &ignore, iterator_type curr) ENTT_NOEXCEPT
runtime_view_iterator(const std::vector<const Set *> &cpools, const std::vector<const Set *> &ignore, iterator_type curr) ENTT_NOEXCEPT
: pools{&cpools},
filter{&ignore},
it{curr},
@@ -90,8 +90,8 @@ public:
}
private:
const std::vector<const Type *> *pools;
const std::vector<const Type *> *filter;
const std::vector<const Set *> *pools;
const std::vector<const Set *> *filter;
iterator_type it;
bool tombstone_check;
};

View File

@@ -24,8 +24,10 @@ namespace entt {
*/
template<typename Type>
class sigh_storage_mixin final: public Type {
using basic_iterator = typename Type::basic_iterator;
template<typename Func>
void notify_destruction(typename Type::basic_iterator first, typename Type::basic_iterator last, Func func) {
void notify_destruction(basic_iterator first, basic_iterator last, Func func) {
ENTT_ASSERT(owner != nullptr, "Invalid pointer to registry");
for(; first != last; ++first) {
@@ -36,15 +38,15 @@ class sigh_storage_mixin final: public Type {
}
}
void swap_and_pop(typename Type::basic_iterator first, typename Type::basic_iterator last) final {
void swap_and_pop(basic_iterator first, basic_iterator last) final {
notify_destruction(std::move(first), std::move(last), [this](auto... args) { Type::swap_and_pop(args...); });
}
void in_place_pop(typename Type::basic_iterator first, typename Type::basic_iterator last) final {
void in_place_pop(basic_iterator first, basic_iterator last) final {
notify_destruction(std::move(first), std::move(last), [this](auto... args) { Type::in_place_pop(args...); });
}
typename Type::basic_iterator try_emplace(const typename Type::entity_type entt, const bool force_back, const void *value) final {
basic_iterator try_emplace(const typename Type::entity_type entt, const bool force_back, const void *value) final {
ENTT_ASSERT(owner != nullptr, "Invalid pointer to registry");
Type::try_emplace(entt, force_back, value);
construction.publish(*owner, entt);
@@ -52,8 +54,6 @@ class sigh_storage_mixin final: public Type {
}
public:
/*! @brief Underlying value type. */
using value_type = typename Type::value_type;
/*! @brief Underlying entity identifier. */
using entity_type = typename Type::entity_type;