Browse Source

entity: handle conversion warnings

Michele Caini 1 year ago
parent
commit
b10ba4da1c
3 changed files with 5 additions and 5 deletions
  1. 3 3
      src/entt/entity/group.hpp
  2. 1 1
      src/entt/entity/registry.hpp
  3. 1 1
      src/entt/entity/sparse_set.hpp

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

@@ -794,7 +794,7 @@ public:
      * @return An iterator to the first entity of the group.
      */
     [[nodiscard]] iterator begin() const noexcept {
-        return *this ? (handle().end() - descriptor->length()) : iterator{};
+        return *this ? (handle().end() - static_cast<typename iterator::difference_type>(descriptor->length())) : iterator{};
     }
 
     /**
@@ -824,7 +824,7 @@ public:
      * reversed group.
      */
     [[nodiscard]] reverse_iterator rend() const noexcept {
-        return *this ? (handle().rbegin() + descriptor->length()) : reverse_iterator{};
+        return *this ? (handle().rbegin() + static_cast<typename reverse_iterator::difference_type>(descriptor->length())) : reverse_iterator{};
     }
 
     /**
@@ -864,7 +864,7 @@ public:
      * @return The identifier that occupies the given position.
      */
     [[nodiscard]] entity_type operator[](const size_type pos) const {
-        return begin()[pos];
+        return begin()[static_cast<typename iterator::difference_type>(pos)];
     }
 
     /**

+ 1 - 1
src/entt/entity/registry.hpp

@@ -960,7 +960,7 @@ public:
     void clear() {
         if constexpr(sizeof...(Type) == 0u) {
             for(size_type pos = pools.size(); pos; --pos) {
-                pools.begin()[pos - 1u].second->clear();
+                pools.begin()[static_cast<typename pool_container_type::difference_type>(pos - 1u)].second->clear();
             }
 
             const auto elem = entities.each();

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

@@ -904,7 +904,7 @@ public:
                     ++first;
                 }
 
-                count += std::distance(it, first);
+                count += static_cast<size_type>(std::distance(it, first));
                 erase(it, first);
             }
         } else {