|
|
@@ -15,7 +15,7 @@ struct enum_as_bitmask: std::false_type {};
|
|
|
|
|
|
/*! @copydoc enum_as_bitmask */
|
|
|
template<typename Type>
|
|
|
-struct enum_as_bitmask<Type, std::void_t<decltype(Type::_entt_enum_as_bitmask)>>: std::true_type {};
|
|
|
+struct enum_as_bitmask<Type, std::void_t<decltype(Type::_entt_enum_as_bitmask)>>: std::is_enum<Type> {};
|
|
|
|
|
|
/**
|
|
|
* @brief Helper variable template.
|
|
|
@@ -35,21 +35,21 @@ inline constexpr bool enum_as_bitmask_v = enum_as_bitmask<Type>::value;
|
|
|
* two values provided.
|
|
|
*/
|
|
|
template<typename Type>
|
|
|
-[[nodiscard]] constexpr std::enable_if_t<std::is_enum_v<Type> && entt::enum_as_bitmask_v<Type>, Type>
|
|
|
+[[nodiscard]] constexpr std::enable_if_t<entt::enum_as_bitmask_v<Type>, Type>
|
|
|
operator|(const Type lhs, const Type rhs) ENTT_NOEXCEPT {
|
|
|
return static_cast<Type>(static_cast<std::underlying_type_t<Type>>(lhs) | static_cast<std::underlying_type_t<Type>>(rhs));
|
|
|
}
|
|
|
|
|
|
/*! @copydoc operator| */
|
|
|
template<typename Type>
|
|
|
-[[nodiscard]] constexpr std::enable_if_t<std::is_enum_v<Type> && entt::enum_as_bitmask_v<Type>, Type>
|
|
|
+[[nodiscard]] constexpr std::enable_if_t<entt::enum_as_bitmask_v<Type>, Type>
|
|
|
operator&(const Type lhs, const Type rhs) ENTT_NOEXCEPT {
|
|
|
return static_cast<Type>(static_cast<std::underlying_type_t<Type>>(lhs) & static_cast<std::underlying_type_t<Type>>(rhs));
|
|
|
}
|
|
|
|
|
|
/*! @copydoc operator| */
|
|
|
template<typename Type>
|
|
|
-[[nodiscard]] constexpr std::enable_if_t<std::is_enum_v<Type> && entt::enum_as_bitmask_v<Type>, Type>
|
|
|
+[[nodiscard]] constexpr std::enable_if_t<entt::enum_as_bitmask_v<Type>, Type>
|
|
|
operator^(const Type lhs, const Type rhs) ENTT_NOEXCEPT {
|
|
|
return static_cast<Type>(static_cast<std::underlying_type_t<Type>>(lhs) ^ static_cast<std::underlying_type_t<Type>>(rhs));
|
|
|
}
|
|
|
@@ -62,35 +62,35 @@ operator^(const Type lhs, const Type rhs) ENTT_NOEXCEPT {
|
|
|
* value provided.
|
|
|
*/
|
|
|
template<typename Type>
|
|
|
-[[nodiscard]] constexpr std::enable_if_t<std::is_enum_v<Type> && entt::enum_as_bitmask_v<Type>, Type>
|
|
|
+[[nodiscard]] constexpr std::enable_if_t<entt::enum_as_bitmask_v<Type>, Type>
|
|
|
operator~(const Type value) ENTT_NOEXCEPT {
|
|
|
return static_cast<Type>(~static_cast<std::underlying_type_t<Type>>(value));
|
|
|
}
|
|
|
|
|
|
/*! @copydoc operator~ */
|
|
|
template<typename Type>
|
|
|
-[[nodiscard]] constexpr std::enable_if_t<std::is_enum_v<Type> && entt::enum_as_bitmask_v<Type>, bool>
|
|
|
+[[nodiscard]] constexpr std::enable_if_t<entt::enum_as_bitmask_v<Type>, bool>
|
|
|
operator!(const Type value) ENTT_NOEXCEPT {
|
|
|
return !static_cast<std::underlying_type_t<Type>>(value);
|
|
|
}
|
|
|
|
|
|
/*! @copydoc operator| */
|
|
|
template<typename Type>
|
|
|
-constexpr std::enable_if_t<std::is_enum_v<Type> && entt::enum_as_bitmask_v<Type>, Type &>
|
|
|
+constexpr std::enable_if_t<entt::enum_as_bitmask_v<Type>, Type &>
|
|
|
operator|=(Type &lhs, const Type rhs) ENTT_NOEXCEPT {
|
|
|
return (lhs = (lhs | rhs));
|
|
|
}
|
|
|
|
|
|
/*! @copydoc operator| */
|
|
|
template<typename Type>
|
|
|
-constexpr std::enable_if_t<std::is_enum_v<Type> && entt::enum_as_bitmask_v<Type>, Type &>
|
|
|
+constexpr std::enable_if_t<entt::enum_as_bitmask_v<Type>, Type &>
|
|
|
operator&=(Type &lhs, const Type rhs) ENTT_NOEXCEPT {
|
|
|
return (lhs = (lhs & rhs));
|
|
|
}
|
|
|
|
|
|
/*! @copydoc operator| */
|
|
|
template<typename Type>
|
|
|
-constexpr std::enable_if_t<std::is_enum_v<Type> && entt::enum_as_bitmask_v<Type>, Type &>
|
|
|
+constexpr std::enable_if_t<entt::enum_as_bitmask_v<Type>, Type &>
|
|
|
operator^=(Type &lhs, const Type rhs) ENTT_NOEXCEPT {
|
|
|
return (lhs = (lhs ^ rhs));
|
|
|
}
|