1
0
Эх сурвалжийг харах

sparse_set: use aliases as much as possible

Michele Caini 2 жил өмнө
parent
commit
921160a483

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

@@ -217,8 +217,8 @@ class basic_sparse_set {
         auto &lhs = packed[from];
         auto &rhs = packed[to];
 
-        sparse_ref(lhs) = traits_type::combine(static_cast<typename traits_type::entity_type>(to), traits_type::to_integral(lhs));
-        sparse_ref(rhs) = traits_type::combine(static_cast<typename traits_type::entity_type>(from), traits_type::to_integral(rhs));
+        sparse_ref(lhs) = traits_type::combine(static_cast<underlying_type>(to), traits_type::to_integral(lhs));
+        sparse_ref(rhs) = traits_type::combine(static_cast<underlying_type>(from), traits_type::to_integral(rhs));
 
         std::swap(lhs, rhs);
     }
@@ -349,12 +349,12 @@ protected:
         case deletion_policy::swap_and_pop:
             packed.push_back(entt);
             ENTT_ASSERT(elem == null, "Slot not available");
-            elem = traits_type::combine(static_cast<typename traits_type::entity_type>(packed.size() - 1u), traits_type::to_integral(entt));
+            elem = traits_type::combine(static_cast<underlying_type>(packed.size() - 1u), traits_type::to_integral(entt));
             break;
         case deletion_policy::swap_only:
             if(elem == null) {
                 packed.push_back(entt);
-                elem = traits_type::combine(static_cast<typename traits_type::entity_type>(packed.size() - 1u), traits_type::to_integral(entt));
+                elem = traits_type::combine(static_cast<underlying_type>(packed.size() - 1u), traits_type::to_integral(entt));
             } else {
                 ENTT_ASSERT(!(traits_type::to_entity(elem) < head), "Slot not available");
                 bump(entt);
@@ -925,7 +925,7 @@ public:
                     swap_or_move(from, to);
 
                     packed[to] = packed[from];
-                    const auto elem = static_cast<typename traits_type::entity_type>(to);
+                    const auto elem = static_cast<underlying_type>(to);
                     sparse_ref(packed[to]) = traits_type::combine(elem, traits_type::to_integral(packed[to]));
 
                     for(; from && packed[from - 1u] == tombstone; --from) {}
@@ -1004,7 +1004,7 @@ public:
                 const auto entt = packed[curr];
 
                 swap_or_move(next, idx);
-                const auto elem = static_cast<typename traits_type::entity_type>(curr);
+                const auto elem = static_cast<underlying_type>(curr);
                 sparse_ref(entt) = traits_type::combine(elem, traits_type::to_integral(packed[curr]));
                 curr = std::exchange(next, idx);
             }