Using enums for storing bitflags in C++ is a bit troublesome, since once the enum values are ORed they loose their enum-type, which causes errors without explicit casting.
The accepted answer for this question suggests overloading the | operator:
FlagsSet operator|(FlagsSet a, FlagsSet b) { return FlagsSet(int(a) | int(b)); } I'd like to know if this method has any runtime implications?
inttounsigned- otherwise you're asking for other code to end up with sign-extension issues (bit flags are never signed! that would be insanely foolish).