#include <iostream>
enum class NumericType
{
None = 0,
PadWithZero = 0x01,
NegativeSign = 0x02,
PositiveSign = 0x04,
SpacePrefix = 0x08
};
NumericType operator |= (NumericType &a, NumericType b) {
unsigned ai = static_cast<unsigned>(a);
unsigned bi = static_cast<unsigned>(b);
ai |= bi;
return a = static_cast<NumericType>(ai);
}
std::ostream & operator << (std::ostream &os, NumericType x) {
return os << static_cast<unsigned>(x);
}
int main ()
{
NumericType a = NumericType::PadWithZero;
NumericType b = NumericType::SpacePrefix;
a |= b;
std::cout
<< std::hex
<< "a: " << a << std::endl
<< "b: " << b << std::endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgogCmVudW0gY2xhc3MgTnVtZXJpY1R5cGUKewogICAgTm9uZSAgICAgICAgICAgICAgICAgICAgPSAwLAogICAgUGFkV2l0aFplcm8gICAgICAgICAgICAgPSAweDAxLAogICAgTmVnYXRpdmVTaWduICAgICAgICAgICAgPSAweDAyLAogICAgUG9zaXRpdmVTaWduICAgICAgICAgICAgPSAweDA0LAogICAgU3BhY2VQcmVmaXggICAgICAgICAgICAgPSAweDA4Cn07CiAKTnVtZXJpY1R5cGUgb3BlcmF0b3IgfD0gKE51bWVyaWNUeXBlICZhLCBOdW1lcmljVHlwZSBiKSB7CiAgICB1bnNpZ25lZCBhaSA9IHN0YXRpY19jYXN0PHVuc2lnbmVkPihhKTsKICAgIHVuc2lnbmVkIGJpID0gc3RhdGljX2Nhc3Q8dW5zaWduZWQ+KGIpOwogICAgYWkgfD0gYmk7CiAgICByZXR1cm4gYSA9IHN0YXRpY19jYXN0PE51bWVyaWNUeXBlPihhaSk7Cn0KCnN0ZDo6b3N0cmVhbSAmIG9wZXJhdG9yIDw8IChzdGQ6Om9zdHJlYW0gJm9zLCBOdW1lcmljVHlwZSB4KSB7CiAgICByZXR1cm4gb3MgPDwgc3RhdGljX2Nhc3Q8dW5zaWduZWQ+KHgpOwp9CiAKaW50IG1haW4gKCkKewogICAgTnVtZXJpY1R5cGUgYSA9IE51bWVyaWNUeXBlOjpQYWRXaXRoWmVybzsKICAgIE51bWVyaWNUeXBlIGIgPSBOdW1lcmljVHlwZTo6U3BhY2VQcmVmaXg7CiAgICBhIHw9IGI7CiAgICBzdGQ6OmNvdXQKICAgICAgICA8PCBzdGQ6OmhleAogICAgICAgIDw8ICJhOiAiIDw8IGEgPDwgc3RkOjplbmRsCiAgICAgICAgPDwgImI6ICIgPDwgYiA8PCBzdGQ6OmVuZGw7Cn0=