From 4d2666a0e30cb1055df4b9e4e2fcea5596281e5c Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Wed, 1 May 2019 15:30:12 +0200 Subject: [PATCH] minor changes (close #235) --- src/entt/entity/sparse_set.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/entt/entity/sparse_set.hpp b/src/entt/entity/sparse_set.hpp index c8442c9b4..3cfe85be7 100644 --- a/src/entt/entity/sparse_set.hpp +++ b/src/entt/entity/sparse_set.hpp @@ -68,7 +68,7 @@ class sparse_set { using direct_type = const std::vector; using index_type = typename traits_type::difference_type; - iterator(direct_type *ref, index_type idx) ENTT_NOEXCEPT + iterator(direct_type *ref, const index_type idx) ENTT_NOEXCEPT : direct{ref}, index{idx} {} @@ -163,7 +163,7 @@ class sparse_set { index_type index; }; - void assure(std::size_t page) { + void assure(const std::size_t page) { if(!(page < reverse.size())) { reverse.resize(page+1); } @@ -175,7 +175,7 @@ class sparse_set { } } - auto index(Entity entt) const ENTT_NOEXCEPT { + auto index(const Entity entt) const ENTT_NOEXCEPT { const auto identifier = entt & traits_type::entity_mask; const auto page = size_type(identifier / entt_per_page); const auto offset = size_type(identifier & (entt_per_page - 1)); @@ -459,8 +459,8 @@ public: ENTT_ASSERT(has(entt)); auto [from_page, from_offset] = index(entt); auto [to_page, to_offset] = index(direct.back()); - std::swap(direct[size_type(reverse[from_page].first[from_offset])], direct.back()); - std::swap(reverse[from_page].first[from_offset], reverse[to_page].first[to_offset]); + direct[size_type(reverse[from_page].first[from_offset])] = direct.back(); + reverse[to_page].first[to_offset] = reverse[from_page].first[from_offset]; reverse[from_page].first[from_offset] = null; reverse[from_page].second--; direct.pop_back(); @@ -576,7 +576,7 @@ class sparse_set: public sparse_set { using instance_type = std::conditional_t, std::vector>; using index_type = typename traits_type::difference_type; - iterator(instance_type *ref, index_type idx) ENTT_NOEXCEPT + iterator(instance_type *ref, const index_type idx) ENTT_NOEXCEPT : instances{ref}, index{idx} {} @@ -678,7 +678,7 @@ class sparse_set: public sparse_set { using instance_type = std::conditional_t; using index_type = typename traits_type::difference_type; - iterator(instance_type *ref, index_type idx) ENTT_NOEXCEPT + iterator(instance_type *ref, const index_type idx) ENTT_NOEXCEPT : instance{ref}, index{idx} {}