1#ifndef UVW_ENUM_INCLUDE_HPP
2#define UVW_ENUM_INCLUDE_HPP
15template<
typename Type>
16[[nodiscard]]
constexpr std::enable_if_t<std::is_enum_v<Type>,
decltype(Type::_UVW_ENUM)>
17operator|(
const Type lhs,
const Type rhs)
noexcept {
18 return static_cast<Type
>(
static_cast<std::underlying_type_t<Type>
>(lhs) |
static_cast<std::underlying_type_t<Type>
>(rhs));
22template<
typename Type>
23[[nodiscard]]
constexpr std::enable_if_t<std::is_enum_v<Type>,
decltype(Type::_UVW_ENUM)>
24operator&(
const Type lhs,
const Type rhs)
noexcept {
25 return static_cast<Type
>(
static_cast<std::underlying_type_t<Type>
>(lhs) &
static_cast<std::underlying_type_t<Type>
>(rhs));
29template<
typename Type>
30[[nodiscard]]
constexpr std::enable_if_t<std::is_enum_v<Type>,
decltype(Type::_UVW_ENUM)>
31operator^(
const Type lhs,
const Type rhs)
noexcept {
32 return static_cast<Type
>(
static_cast<std::underlying_type_t<Type>
>(lhs) ^
static_cast<std::underlying_type_t<Type>
>(rhs));
42template<
typename Type>
43[[nodiscard]]
constexpr std::enable_if_t<std::is_enum_v<Type>,
decltype(Type::_UVW_ENUM)>
44operator~(
const Type value)
noexcept {
45 return static_cast<Type
>(~static_cast<std::underlying_type_t<Type>>(value));
49template<
typename Type>
50[[nodiscard]]
constexpr std::enable_if_t<std::is_enum_v<Type>,
decltype(Type::_UVW_ENUM,
bool{})>
51operator!(
const Type value)
noexcept {
52 return !
static_cast<std::underlying_type_t<Type>
>(value);
56template<
typename Type>
57constexpr std::enable_if_t<std::is_enum_v<Type>,
decltype(Type::_UVW_ENUM) &>
58operator|=(Type &lhs,
const Type rhs)
noexcept {
59 return (lhs = (lhs | rhs));
63template<
typename Type>
64constexpr std::enable_if_t<std::is_enum_v<Type>,
decltype(Type::_UVW_ENUM) &>
65operator&=(Type &lhs,
const Type rhs)
noexcept {
66 return (lhs = (lhs & rhs));
70template<
typename Type>
71constexpr std::enable_if_t<std::is_enum_v<Type>,
decltype(Type::_UVW_ENUM) &>
72operator^=(Type &lhs,
const Type rhs)
noexcept {
73 return (lhs = (lhs ^ rhs));