Bläddra i källkod

core: use fold expressions rather than std::disjunction if possible

Michele Caini 3 år sedan
förälder
incheckning
436b2b3140
2 ändrade filer med 2 tillägg och 2 borttagningar
  1. 1 1
      src/entt/core/ident.hpp
  2. 1 1
      src/entt/core/type_traits.hpp

+ 1 - 1
src/entt/core/ident.hpp

@@ -41,7 +41,7 @@ template<typename... Types>
 class identifier {
     template<typename Type, std::size_t... Index>
     [[nodiscard]] static constexpr id_type get(std::index_sequence<Index...>) ENTT_NOEXCEPT {
-        static_assert(std::disjunction_v<std::is_same<Type, Types>...>, "Invalid type");
+        static_assert((std::is_same_v<Type, Types> || ...), "Invalid type");
         return (0 + ... + (std::is_same_v<Type, type_list_element_t<Index, type_list<std::decay_t<Types>...>>> ? id_type{Index} : id_type{}));
     }
 

+ 1 - 1
src/entt/core/type_traits.hpp

@@ -211,7 +211,7 @@ template<typename Type, typename... Other>
 struct type_list_unique<type_list<Type, Other...>> {
     /*! @brief A type list without duplicate types. */
     using type = std::conditional_t<
-        std::disjunction_v<std::is_same<Type, Other>...>,
+        (std::is_same_v<Type, Other> || ...),
         typename type_list_unique<type_list<Other...>>::type,
         type_list_cat_t<type_list<Type>, typename type_list_unique<type_list<Other...>>::type>>;
 };