Parcourir la source

fixed compilation errors and suppressed warnings with clang

Michele Caini il y a 7 ans
Parent
commit
a478e4acc9
2 fichiers modifiés avec 8 ajouts et 3 suppressions
  1. 6 2
      src/entt/core/ident.hpp
  2. 2 1
      src/entt/entity/registry.hpp

+ 6 - 2
src/entt/core/ident.hpp

@@ -6,7 +6,6 @@
 #include <cstddef>
 #include <utility>
 #include <tuple>
-#include <algorithm>
 #include "../config/config.h"
 
 
@@ -75,7 +74,12 @@ class Identifier final {
     template<typename Type, std::size_t... Indexes>
     static constexpr std::size_t get(std::index_sequence<Indexes...>) ENTT_NOEXCEPT {
         static_assert(internal::IsPartOf<Type, Types...>::value, "!");
-        return std::max({ (std::is_same<Type, std::tuple_element_t<Indexes, tuple_type>>::value ? Indexes : std::size_t{})... });
+
+        std::size_t max{};
+        using accumulator_type = std::size_t[];
+        accumulator_type accumulator = { (max = std::is_same<Type, std::tuple_element_t<Indexes, tuple_type>>::value ? Indexes : max)... };
+        (void)accumulator;
+        return max;
     }
 
 public:

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

@@ -1163,7 +1163,8 @@ public:
      */
     void reset() {
         each([this](const auto entity) {
-            destroy(entity);
+            // useless this-> used to suppress a warning with clang
+            this->destroy(entity);
         });
     }