Browse Source

sparse_set: prepare to drop swap_at

Michele Caini 2 years ago
parent
commit
a9de9da75b
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/entt/entity/sparse_set.hpp

+ 6 - 1
src/entt/entity/sparse_set.hpp

@@ -868,7 +868,12 @@ public:
 
         // basic no-leak guarantee if swapping throws
         swap_or_move(from, to);
-        swap_at(from, to);
+
+        sparse_ref(packed[from]) = traits_type::combine(static_cast<typename traits_type::entity_type>(to), traits_type::to_integral(lhs));
+        sparse_ref(packed[to]) = traits_type::combine(static_cast<typename traits_type::entity_type>(from), traits_type::to_integral(rhs));
+
+        packed[from] = rhs;
+        packed[to] = lhs;
     }
 
     /**