mirror of
https://github.com/AxioDL/boo.git
synced 2025-06-12 09:33:31 +00:00
Merge pull request #39 from lioncash/noexcept
System: Make enum functions noexcept
This commit is contained in:
commit
5fc8f05d8e
@ -29,35 +29,34 @@ 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>; \
|
return !True(key); \
|
||||||
return static_cast<T>(key) == 0; \
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user