Skip to content

Commit 153e74f

Browse files
committed
Add constexpr for bitmask operators
1 parent 48da238 commit 153e74f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

include/flatbuffers/flatbuffers.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,31 +248,31 @@ inline const char *flatbuffers_version_string() {
248248

249249
// clang-format off
250250
#define FLATBUFFERS_DEFINE_BITMASK_OPERATORS(E, T)\
251-
inline E operator | (E lhs, E rhs){\
251+
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator | (E lhs, E rhs){\
252252
return E(T(lhs) | T(rhs));\
253253
}\
254-
inline E operator & (E lhs, E rhs){\
254+
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator & (E lhs, E rhs){\
255255
return E(T(lhs) & T(rhs));\
256256
}\
257-
inline E operator ^ (E lhs, E rhs){\
257+
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator ^ (E lhs, E rhs){\
258258
return E(T(lhs) ^ T(rhs));\
259259
}\
260-
inline E operator ~ (E lhs){\
260+
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator ~ (E lhs){\
261261
return E(~T(lhs));\
262262
}\
263-
inline E operator |= (E &lhs, E rhs){\
263+
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator |= (E &lhs, E rhs){\
264264
lhs = lhs | rhs;\
265265
return lhs;\
266266
}\
267-
inline E operator &= (E &lhs, E rhs){\
267+
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator &= (E &lhs, E rhs){\
268268
lhs = lhs & rhs;\
269269
return lhs;\
270270
}\
271-
inline E operator ^= (E &lhs, E rhs){\
271+
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator ^= (E &lhs, E rhs){\
272272
lhs = lhs ^ rhs;\
273273
return lhs;\
274274
}\
275-
inline bool operator !(E rhs) \
275+
inline FLATBUFFERS_CONSTEXPR_CPP11 bool operator !(E rhs) \
276276
{\
277277
return !bool(T(rhs)); \
278278
}

0 commit comments

Comments
 (0)