mirror of https://github.com/AxioDL/boo.git
Merge pull request #22 from lioncash/constexpr
System: Make operator|= and operator&= for enums constexpr
This commit is contained in:
commit
9c210e5989
|
@ -37,12 +37,12 @@ static inline ComPtr<T>* ReferenceComPtr(ComPtr<T>& ptr) {
|
||||||
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)); \
|
||||||
} \
|
} \
|
||||||
inline type& operator|=(type& a, const type& b) { \
|
constexpr type& operator|=(type& a, type b) { \
|
||||||
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; \
|
||||||
} \
|
} \
|
||||||
inline type& operator&=(type& a, const type& b) { \
|
constexpr type& operator&=(type& a, type b) { \
|
||||||
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; \
|
||||||
|
|
Loading…
Reference in New Issue