From e0979fcf3f01269fb1bb5e44f288d81cedd579ca Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Sat, 8 Jan 2022 16:14:54 +0100 Subject: [PATCH] sparse_set/storage: make empty virtual functions private (moving towards private-only hooks) --- src/entt/entity/sparse_set.hpp | 14 ++++---------- src/entt/entity/storage.hpp | 3 +-- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/entt/entity/sparse_set.hpp b/src/entt/entity/sparse_set.hpp index 76530a31b..02c852f10 100644 --- a/src/entt/entity/sparse_set.hpp +++ b/src/entt/entity/sparse_set.hpp @@ -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. diff --git a/src/entt/entity/storage.hpp b/src/entt/entity/storage.hpp index a4c288b86..080755eb5 100644 --- a/src/entt/entity/storage.hpp +++ b/src/entt/entity/storage.hpp @@ -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); } /**