소스 검색

sparse set: minor changes

Michele Caini 5 년 전
부모
커밋
6a1a5a0f74
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 3
      src/entt/entity/sparse_set.hpp

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

@@ -370,7 +370,7 @@ public:
      */
     [[nodiscard]] size_type index(const entity_type entt) const {
         ENTT_ASSERT(contains(entt));
-        return size_type(sparse[page(entt)][offset(entt)]);
+        return size_type{to_integral(sparse[page(entt)][offset(entt)])};
     }
 
     /**
@@ -430,7 +430,7 @@ public:
         ENTT_ASSERT(contains(entt));
         const auto curr = page(entt);
         const auto pos = offset(entt);
-        packed[size_type(sparse[curr][pos])] = packed.back();
+        packed[size_type{to_integral(sparse[curr][pos])}] = packed.back();
         sparse[page(packed.back())][offset(packed.back())] = sparse[curr][pos];
         sparse[curr][pos] = null;
         packed.pop_back();
@@ -454,7 +454,7 @@ public:
     virtual void swap(const entity_type lhs, const entity_type rhs) {
         auto &from = sparse[page(lhs)][offset(lhs)];
         auto &to = sparse[page(rhs)][offset(rhs)];
-        std::swap(packed[size_type(from)], packed[size_type(to)]);
+        std::swap(packed[size_type{to_integral(from)}], packed[size_type{to_integral(to)}]);
         std::swap(from, to);
     }