sparse_set/storage: make empty virtual functions private (moving towards private-only hooks)

This commit is contained in:
Michele Caini
2022-01-08 16:14:54 +01:00
parent d514ecbd5e
commit e0979fcf3f
2 changed files with 5 additions and 12 deletions

View File

@@ -223,21 +223,15 @@ class basic_sparse_set {
}
}
protected:
/**
* @brief Returns the element assigned to an entity.
* @return An opaque pointer to the element assigned to the entity.
*/
virtual const void *get_at(const std::size_t) const ENTT_NOEXCEPT {
private:
virtual const void *get_at(const std::size_t) const {
return nullptr;
}
/*! @brief Swaps two entities in a sparse set. */
virtual void swap_at(const std::size_t, const std::size_t) {}
/*! @brief Moves an entity in a sparse set. */
virtual void move_element(const std::size_t, const std::size_t) {}
protected:
/**
* @brief Erases an entity from a sparse set.
* @param pos A valid position of an element within a sparse set.
@@ -783,7 +777,7 @@ public:
}
/**
* @copybrief swap_at
* @brief Swaps two entities in a sparse set.
*
* For what it's worth, this function affects both the internal sparse array
* and the internal packed array. Users should not care of that anyway.

View File

@@ -321,7 +321,7 @@ protected:
* @param pos A valid position of an element within a storage.
* @return An opaque pointer to the element assigned to the entity.
*/
const void *get_at(const std::size_t pos) const ENTT_NOEXCEPT override {
const void *get_at(const std::size_t pos) const override {
return std::addressof(element_at(pos));
}
@@ -343,7 +343,6 @@ protected:
auto &elem = element_at(from);
construct(assure_at_least(to), std::move(elem));
std::destroy_at(std::addressof(elem));
base_type::move_element(from, to);
}
/**