Просмотр исходного кода

core: updated ident, removed dependency on <tuple>

Michele Caini 5 лет назад
Родитель
Сommit
330f3dff77
1 измененных файлов с 4 добавлено и 6 удалено
  1. 4 6
      src/entt/core/ident.hpp

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

@@ -2,12 +2,12 @@
 #define ENTT_CORE_IDENT_HPP
 
 
-#include <tuple>
 #include <cstddef>
 #include <utility>
 #include <type_traits>
 #include "../config/config.h"
 #include "fwd.hpp"
+#include "type_traits.hpp"
 
 
 namespace entt {
@@ -42,12 +42,10 @@ namespace entt {
  */
 template<typename... Types>
 class identifier {
-    using tuple_type = std::tuple<std::decay_t<Types>...>;
-
-    template<typename Type, std::size_t... Indexes>
-    [[nodiscard]] static constexpr id_type get(std::index_sequence<Indexes...>) {
+    template<typename Type, std::size_t... Index>
+    [[nodiscard]] static constexpr id_type get(std::index_sequence<Index...>) {
         static_assert(std::disjunction_v<std::is_same<Type, Types>...>, "Invalid type");
-        return (0 + ... + (std::is_same_v<Type, std::tuple_element_t<Indexes, tuple_type>> ? id_type(Indexes) : id_type{}));
+        return (0 + ... + (std::is_same_v<Type, type_list_element_t<Index, type_list<std::decay_t<Types>...>>> ? id_type{Index} : id_type{}));
     }
 
 public: