skypjack 1 день назад
Родитель
Сommit
c60e076f80
4 измененных файлов с 14 добавлено и 13 удалено
  1. 5 5
      src/entt/core/enum.hpp
  2. 2 2
      src/entt/entity/entity.hpp
  3. 6 6
      src/entt/meta/node.hpp
  4. 1 0
      src/entt/stl/type_traits.hpp

+ 5 - 5
src/entt/core/enum.hpp

@@ -48,19 +48,19 @@ concept enum_bitmask = std::is_enum_v<Type> && enum_as_bitmask_v<Type>;
  */
  */
 template<entt::enum_bitmask Type>
 template<entt::enum_bitmask Type>
 [[nodiscard]] constexpr Type operator|(const Type lhs, const Type rhs) noexcept {
 [[nodiscard]] constexpr Type operator|(const Type lhs, const Type rhs) noexcept {
-    return static_cast<Type>(static_cast<std::underlying_type_t<Type>>(lhs) | static_cast<std::underlying_type_t<Type>>(rhs));
+    return static_cast<Type>(static_cast<stl::underlying_type_t<Type>>(lhs) | static_cast<stl::underlying_type_t<Type>>(rhs));
 }
 }
 
 
 /*! @copydoc operator| */
 /*! @copydoc operator| */
 template<entt::enum_bitmask Type>
 template<entt::enum_bitmask Type>
 [[nodiscard]] constexpr Type operator&(const Type lhs, const Type rhs) noexcept {
 [[nodiscard]] constexpr Type operator&(const Type lhs, const Type rhs) noexcept {
-    return static_cast<Type>(static_cast<std::underlying_type_t<Type>>(lhs) & static_cast<std::underlying_type_t<Type>>(rhs));
+    return static_cast<Type>(static_cast<stl::underlying_type_t<Type>>(lhs) & static_cast<stl::underlying_type_t<Type>>(rhs));
 }
 }
 
 
 /*! @copydoc operator| */
 /*! @copydoc operator| */
 template<entt::enum_bitmask Type>
 template<entt::enum_bitmask Type>
 [[nodiscard]] constexpr Type operator^(const Type lhs, const Type rhs) noexcept {
 [[nodiscard]] constexpr Type operator^(const Type lhs, const Type rhs) noexcept {
-    return static_cast<Type>(static_cast<std::underlying_type_t<Type>>(lhs) ^ static_cast<std::underlying_type_t<Type>>(rhs));
+    return static_cast<Type>(static_cast<stl::underlying_type_t<Type>>(lhs) ^ static_cast<stl::underlying_type_t<Type>>(rhs));
 }
 }
 
 
 /**
 /**
@@ -72,13 +72,13 @@ template<entt::enum_bitmask Type>
  */
  */
 template<entt::enum_bitmask Type>
 template<entt::enum_bitmask Type>
 [[nodiscard]] constexpr Type operator~(const Type value) noexcept {
 [[nodiscard]] constexpr Type operator~(const Type value) noexcept {
-    return static_cast<Type>(~static_cast<std::underlying_type_t<Type>>(value));
+    return static_cast<Type>(~static_cast<stl::underlying_type_t<Type>>(value));
 }
 }
 
 
 /*! @copydoc operator~ */
 /*! @copydoc operator~ */
 template<entt::enum_bitmask Type>
 template<entt::enum_bitmask Type>
 [[nodiscard]] constexpr bool operator!(const Type value) noexcept {
 [[nodiscard]] constexpr bool operator!(const Type value) noexcept {
-    return !static_cast<std::underlying_type_t<Type>>(value);
+    return !static_cast<stl::underlying_type_t<Type>>(value);
 }
 }
 
 
 /*! @copydoc operator| */
 /*! @copydoc operator| */

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

@@ -21,9 +21,9 @@ struct entt_traits;
 template<typename Type>
 template<typename Type>
 requires requires {
 requires requires {
     requires std::is_enum_v<Type>;
     requires std::is_enum_v<Type>;
-    typename internal::entt_traits<std::underlying_type_t<Type>>::value_type;
+    typename internal::entt_traits<stl::underlying_type_t<Type>>::value_type;
 }
 }
-struct entt_traits<Type>: entt_traits<std::underlying_type_t<Type>> {
+struct entt_traits<Type>: entt_traits<stl::underlying_type_t<Type>> {
     using value_type = Type;
     using value_type = Type;
 };
 };
 
 

+ 6 - 6
src/entt/meta/node.hpp

@@ -46,16 +46,16 @@ enum class meta_traits : std::uint32_t {
 template<typename Type>
 template<typename Type>
 requires std::is_enum_v<Type>
 requires std::is_enum_v<Type>
 [[nodiscard]] auto meta_to_user_traits(const meta_traits traits) noexcept {
 [[nodiscard]] auto meta_to_user_traits(const meta_traits traits) noexcept {
-    constexpr auto shift = std::popcount(static_cast<std::underlying_type_t<meta_traits>>(meta_traits::_user_defined_traits));
-    return Type{static_cast<std::underlying_type_t<Type>>(static_cast<std::underlying_type_t<meta_traits>>(traits) >> shift)};
+    constexpr auto shift = std::popcount(static_cast<stl::underlying_type_t<meta_traits>>(meta_traits::_user_defined_traits));
+    return Type{static_cast<stl::underlying_type_t<Type>>(static_cast<stl::underlying_type_t<meta_traits>>(traits) >> shift)};
 }
 }
 
 
 template<typename Type>
 template<typename Type>
 requires std::is_enum_v<Type>
 requires std::is_enum_v<Type>
 [[nodiscard]] auto user_to_meta_traits(const Type value) noexcept {
 [[nodiscard]] auto user_to_meta_traits(const Type value) noexcept {
-    constexpr auto shift = std::popcount(static_cast<std::underlying_type_t<meta_traits>>(meta_traits::_user_defined_traits));
-    const auto traits = static_cast<std::underlying_type_t<internal::meta_traits>>(static_cast<std::underlying_type_t<Type>>(value));
-    ENTT_ASSERT(traits < ((~static_cast<std::underlying_type_t<meta_traits>>(meta_traits::_user_defined_traits)) >> shift), "Invalid traits");
+    constexpr auto shift = std::popcount(static_cast<stl::underlying_type_t<meta_traits>>(meta_traits::_user_defined_traits));
+    const auto traits = static_cast<stl::underlying_type_t<internal::meta_traits>>(static_cast<stl::underlying_type_t<Type>>(value));
+    ENTT_ASSERT(traits < ((~static_cast<stl::underlying_type_t<meta_traits>>(meta_traits::_user_defined_traits)) >> shift), "Invalid traits");
     return meta_traits{traits << shift};
     return meta_traits{traits << shift};
 }
 }
 
 
@@ -240,7 +240,7 @@ auto setup_node_for() noexcept {
         };
         };
     } else if constexpr(std::is_enum_v<Type>) {
     } else if constexpr(std::is_enum_v<Type>) {
         node.conversion_helper = +[](void *lhs, const void *rhs) {
         node.conversion_helper = +[](void *lhs, const void *rhs) {
-            return lhs ? static_cast<double>(*static_cast<Type *>(lhs) = static_cast<Type>(static_cast<std::underlying_type_t<Type>>(*static_cast<const double *>(rhs)))) : static_cast<double>(*static_cast<const Type *>(rhs));
+            return lhs ? static_cast<double>(*static_cast<Type *>(lhs) = static_cast<Type>(static_cast<stl::underlying_type_t<Type>>(*static_cast<const double *>(rhs)))) : static_cast<double>(*static_cast<const Type *>(rhs));
         };
         };
     }
     }
 
 

+ 1 - 0
src/entt/stl/type_traits.hpp

@@ -31,6 +31,7 @@ using std::remove_cvref_t;
 using std::remove_pointer_t;
 using std::remove_pointer_t;
 using std::remove_reference_t;
 using std::remove_reference_t;
 using std::true_type;
 using std::true_type;
+using std::underlying_type_t;
 
 
 } // namespace entt::stl
 } // namespace entt::stl
 /*! @endcond */
 /*! @endcond */