From e03979ebdc1d8529eb6d02b16dcd74dadd2275f9 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Thu, 16 May 2019 22:20:33 +0200 Subject: [PATCH] cleanup --- src/entt/entity/group.hpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/entt/entity/group.hpp b/src/entt/entity/group.hpp index 960bfb2d6..f869b94d0 100644 --- a/src/entt/entity/group.hpp +++ b/src/entt/entity/group.hpp @@ -420,6 +420,12 @@ class basic_group, Owned...> { template using component_iterator_type = decltype(std::declval>().begin()); + // we could use pool_type *..., but vs complains about it and refuses to compile for unknown reasons (likely a bug) + basic_group(const typename basic_registry::size_type *sz, storage> *... owned, storage> *... get) ENTT_NOEXCEPT + : length{sz}, + pools{owned..., get...} + {} + template decltype(auto) from_index(const typename sparse_set::size_type index) { static_assert(!std::is_empty_v); @@ -432,23 +438,18 @@ class basic_group, Owned...> { } template - inline auto swap(int, pool_type *cpool, const std::size_t lhs, const std::size_t rhs) - -> decltype(cpool->raw(), void()) { + inline auto swap(int, const std::size_t lhs, const std::size_t rhs) + -> decltype(std::declval>().raw(), void()) { + auto *cpool = std::get *>(pools); std::swap(cpool->raw()[lhs], cpool->raw()[rhs]); cpool->swap(lhs, rhs); } template - inline void swap(char, pool_type *cpool, const std::size_t lhs, const std::size_t rhs) { - cpool->swap(lhs, rhs); + inline void swap(char, const std::size_t lhs, const std::size_t rhs) { + std::get *>(pools)->swap(lhs, rhs); } - // we could use pool_type *..., but vs complains about it and refuses to compile for unknown reasons (likely a bug) - basic_group(const typename basic_registry::size_type *sz, storage> *... owned, storage> *... get) ENTT_NOEXCEPT - : length{sz}, - pools{owned..., get...} - {} - public: /*! @brief Underlying entity identifier. */ using entity_type = typename sparse_set::entity_type; @@ -759,7 +760,7 @@ public: while(curr != next) { const auto lhs = copy[curr]; const auto rhs = copy[next]; - (swap(0, std::get *>(pools), lhs, rhs), ...); + (swap(0, lhs, rhs), ...); copy[curr] = curr; curr = next; next = copy[curr];