#pragma once #include namespace OpenVic { template struct is_scoped_enum final : std::bool_constant < requires { requires std::is_enum_v; requires !std::is_convertible_v>; } > {}; template inline constexpr bool is_scoped_enum_v = is_scoped_enum::value; template concept IsScopedEnum = is_scoped_enum_v; template struct enable_bitfield final : std::false_type { }; template inline constexpr bool enable_bitfield_v = enable_bitfield::value; template concept EnumSupportBitfield = enable_bitfield_v; } template [[nodiscard]] inline constexpr auto operator|(const T lhs, const T rhs) noexcept { using underlying_type = std::underlying_type_t; return static_cast(static_cast(lhs) | static_cast(rhs)); } template [[nodiscard]] inline constexpr auto operator&(const T lhs, const T rhs) noexcept { using underlying_type = std::underlying_type_t; return static_cast(static_cast(lhs) & static_cast(rhs)); } template [[nodiscard]] inline constexpr auto operator^(const T lhs, const T rhs) noexcept { using underlying_type = std::underlying_type_t; return static_cast(static_cast(lhs) ^ static_cast(rhs)); } template [[nodiscard]] inline constexpr auto operator~(const T lhs) noexcept { using underlying_type = std::underlying_type_t; return static_cast(~static_cast(lhs)); } template inline constexpr decltype(auto) operator|=(T& lhs, const T rhs) noexcept { using underlying_type = std::underlying_type_t; lhs = static_cast(static_cast(lhs) | static_cast(rhs)); return lhs; } template inline constexpr decltype(auto) operator&=(T& lhs, const T rhs) noexcept { using underlying_type = std::underlying_type_t; lhs = static_cast(static_cast(lhs) & static_cast(rhs)); return lhs; } template inline constexpr decltype(auto) operator^=(T& lhs, const T rhs) noexcept { using underlying_type = std::underlying_type_t; lhs = static_cast(static_cast(lhs) ^ static_cast(rhs)); return lhs; } template [[nodiscard]] inline constexpr bool operator<<(const T lhs, const T rhs) noexcept { using underlying_type = std::underlying_type_t; return (lhs & rhs) == rhs; } template [[nodiscard]] inline constexpr bool operator>>(const T lhs, const T rhs) noexcept { using underlying_type = std::underlying_type_t; return (lhs & rhs) == lhs; }