System: Make enum functions noexcept

Allows them to be used within noexcept contexts
This commit is contained in:
Lioncash 2019-09-09 21:00:41 -04:00
parent 4f4250baf7
commit 660df8f7e6
1 changed files with 7 additions and 7 deletions

View File

@ -29,33 +29,33 @@ static inline ComPtr<T>* ReferenceComPtr(ComPtr<T>& ptr) {
#ifndef ENABLE_BITWISE_ENUM #ifndef ENABLE_BITWISE_ENUM
#define ENABLE_BITWISE_ENUM(type) \ #define ENABLE_BITWISE_ENUM(type) \
constexpr type operator|(type a, type b) { \ constexpr type operator|(type a, type b) noexcept { \
using T = std::underlying_type_t<type>; \ using T = std::underlying_type_t<type>; \
return type(static_cast<T>(a) | static_cast<T>(b)); \ return type(static_cast<T>(a) | static_cast<T>(b)); \
} \ } \
constexpr type operator&(type a, type b) { \ constexpr type operator&(type a, type b) noexcept { \
using T = std::underlying_type_t<type>; \ using T = std::underlying_type_t<type>; \
return type(static_cast<T>(a) & static_cast<T>(b)); \ return type(static_cast<T>(a) & static_cast<T>(b)); \
} \ } \
constexpr type& operator|=(type& a, type b) { \ constexpr type& operator|=(type& a, type b) noexcept { \
using T = std::underlying_type_t<type>; \ using T = std::underlying_type_t<type>; \
a = type(static_cast<T>(a) | static_cast<T>(b)); \ a = type(static_cast<T>(a) | static_cast<T>(b)); \
return a; \ return a; \
} \ } \
constexpr type& operator&=(type& a, type b) { \ constexpr type& operator&=(type& a, type b) noexcept { \
using T = std::underlying_type_t<type>; \ using T = std::underlying_type_t<type>; \
a = type(static_cast<T>(a) & static_cast<T>(b)); \ a = type(static_cast<T>(a) & static_cast<T>(b)); \
return a; \ return a; \
} \ } \
constexpr type operator~(type key) { \ constexpr type operator~(type key) noexcept { \
using T = std::underlying_type_t<type>; \ using T = std::underlying_type_t<type>; \
return type(~static_cast<T>(key)); \ return type(~static_cast<T>(key)); \
} \ } \
constexpr bool True(type key) { \ constexpr bool True(type key) noexcept { \
using T = std::underlying_type_t<type>; \ using T = std::underlying_type_t<type>; \
return static_cast<T>(key) != 0; \ return static_cast<T>(key) != 0; \
} \ } \
constexpr bool False(type key) { \ constexpr bool False(type key) noexcept { \
using T = std::underlying_type_t<type>; \ using T = std::underlying_type_t<type>; \
return static_cast<T>(key) == 0; \ return static_cast<T>(key) == 0; \
} }