Kaynağa Gözat

minor changes

Michele Caini 6 yıl önce
ebeveyn
işleme
d63b78f0e7
2 değiştirilmiş dosya ile 3 ekleme ve 10 silme
  1. 1 3
      src/entt/entity/group.hpp
  2. 2 7
      src/entt/entity/storage.hpp

+ 1 - 3
src/entt/entity/group.hpp

@@ -817,9 +817,7 @@ public:
             auto next = copy[curr];
 
             while(curr != next) {
-                const auto lhs = copy[curr];
-                const auto rhs = copy[next];
-                (std::get<pool_type<Owned> *>(pools)->swap(lhs, rhs), ...);
+                (std::get<pool_type<Owned> *>(pools)->swap(copy[curr], copy[next]), ...);
                 copy[curr] = curr;
                 curr = next;
                 next = copy[curr];

+ 2 - 7
src/entt/entity/storage.hpp

@@ -459,10 +459,7 @@ public:
             auto next = copy[curr];
 
             while(curr != next) {
-                const auto lhs = copy[curr];
-                const auto rhs = copy[next];
-                std::swap(instances[lhs], instances[rhs]);
-                underlying_type::swap(lhs, rhs);
+                swap(copy[curr], copy[next]);
                 copy[curr] = curr;
                 curr = next;
                 next = copy[curr];
@@ -504,9 +501,7 @@ public:
 
             if(underlying_type::has(curr)) {
                 if(curr != *(local + pos)) {
-                    auto candidate = underlying_type::get(curr);
-                    std::swap(instances[pos], instances[candidate]);
-                    underlying_type::swap(pos, candidate);
+                    swap(pos, underlying_type::get(curr));
                 }
 
                 --pos;