Skip to content

Commit

Permalink
Add constexpr for bitmask operators
Browse files Browse the repository at this point in the history
  • Loading branch information
xaphier committed Jul 17, 2023
1 parent 48da238 commit 153e74f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions include/flatbuffers/flatbuffers.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,31 +248,31 @@ inline const char *flatbuffers_version_string() {

// clang-format off
#define FLATBUFFERS_DEFINE_BITMASK_OPERATORS(E, T)\
inline E operator | (E lhs, E rhs){\
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator | (E lhs, E rhs){\
return E(T(lhs) | T(rhs));\
}\
inline E operator & (E lhs, E rhs){\
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator & (E lhs, E rhs){\
return E(T(lhs) & T(rhs));\
}\
inline E operator ^ (E lhs, E rhs){\
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator ^ (E lhs, E rhs){\
return E(T(lhs) ^ T(rhs));\
}\
inline E operator ~ (E lhs){\
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator ~ (E lhs){\
return E(~T(lhs));\
}\
inline E operator |= (E &lhs, E rhs){\
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator |= (E &lhs, E rhs){\
lhs = lhs | rhs;\
return lhs;\
}\
inline E operator &= (E &lhs, E rhs){\
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator &= (E &lhs, E rhs){\
lhs = lhs & rhs;\
return lhs;\
}\
inline E operator ^= (E &lhs, E rhs){\
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator ^= (E &lhs, E rhs){\
lhs = lhs ^ rhs;\
return lhs;\
}\
inline bool operator !(E rhs) \
inline FLATBUFFERS_CONSTEXPR_CPP11 bool operator !(E rhs) \
{\
return !bool(T(rhs)); \
}
Expand Down

0 comments on commit 153e74f

Please sign in to comment.