try:
inline QDebug operator<<(QDebug &stream, const amazing &flag) {
if (!flag) {
return stream << testX(0x00);
}
amazing l_copy = flag;
testX l_bit = testX(0x01);
stream.noquote().nospace() << "(";
forever {
if (l_copy.testFlag(l_bit)) {
stream.noquote().nospace() << l_bit;
l_copy.setFlag(l_bit, false);
if (!l_copy) break;
stream.noquote().nospace() << "|";
}
l_bit = testX(qint32(l_bit) << 1);
}
stream.noquote().nospace() << ")";
return stream;
}