Browse Source

entity/*: suppress some warnings here and there

Michele Caini 5 years ago
parent
commit
ad262ea624

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

@@ -186,7 +186,7 @@ class basic_registry {
             const auto index = type_index<Component>::value();
 
             if(!(index < pools.size())) {
-                pools.resize(index+1);
+                pools.resize(size_type(index+1u));
             }
 
             if(auto &&pdata = pools[index]; !pdata.pool) {

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

@@ -107,7 +107,7 @@ class sparse_set {
         }
 
         [[nodiscard]] reference operator[](const difference_type value) const {
-            const auto pos = size_type(index-value-1);
+            const auto pos = size_type(index-value-1u);
             return (*packed)[pos];
         }
 
@@ -136,7 +136,7 @@ class sparse_set {
         }
 
         [[nodiscard]] pointer operator->() const {
-            const auto pos = size_type(index-1);
+            const auto pos = size_type(index-1u);
             return &(*packed)[pos];
         }
 

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

@@ -141,7 +141,7 @@ class storage: public sparse_set<Entity> {
         }
 
         [[nodiscard]] pointer operator->() const ENTT_NOEXCEPT {
-            const auto pos = size_type(index-1);
+            const auto pos = size_type(index-1u);
             return &(*instances)[pos];
         }
 

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

@@ -255,7 +255,7 @@ class basic_view<Entity, exclude_t<Exclude...>, Component...> {
     [[nodiscard]] unchecked_type unchecked(const sparse_set<Entity> *view) const {
         std::size_t pos{};
         unchecked_type other{};
-        ((std::get<pool_type<Component> *>(pools) == view ? nullptr : (other[pos++] = std::get<pool_type<Component> *>(pools))), ...);
+        ((std::get<pool_type<Component> *>(pools) == view ? nullptr : (other[pos] = std::get<pool_type<Component> *>(pools), other[pos++])), ...);
         return other;
     }