Ver Fonte

dense map: avoid implicit conversions

skypjack há 3 meses atrás
pai
commit
d502bf18da
1 ficheiros alterados com 2 adições e 2 exclusões
  1. 2 2
      src/entt/container/dense_map.hpp

+ 2 - 2
src/entt/container/dense_map.hpp

@@ -278,7 +278,7 @@ class dense_map {
     [[nodiscard]] auto constrained_find(const Other &key, const std::size_t bucket) {
     [[nodiscard]] auto constrained_find(const Other &key, const std::size_t bucket) {
         for(auto offset = sparse.first()[bucket]; offset != placeholder_position; offset = packed.first()[offset].next) {
         for(auto offset = sparse.first()[bucket]; offset != placeholder_position; offset = packed.first()[offset].next) {
             if(packed.second()(packed.first()[offset].element.first, key)) {
             if(packed.second()(packed.first()[offset].element.first, key)) {
-                return begin() + offset;
+                return begin() + static_cast<typename iterator::difference_type>(offset);
             }
             }
         }
         }
 
 
@@ -289,7 +289,7 @@ class dense_map {
     [[nodiscard]] auto constrained_find(const Other &key, const std::size_t bucket) const {
     [[nodiscard]] auto constrained_find(const Other &key, const std::size_t bucket) const {
         for(auto offset = sparse.first()[bucket]; offset != placeholder_position; offset = packed.first()[offset].next) {
         for(auto offset = sparse.first()[bucket]; offset != placeholder_position; offset = packed.first()[offset].next) {
             if(packed.second()(packed.first()[offset].element.first, key)) {
             if(packed.second()(packed.first()[offset].element.first, key)) {
-                return cbegin() + offset;
+                return cbegin() + static_cast<typename const_iterator::difference_type>(offset);
             }
             }
         }
         }