喵喔喔
这里有一些常见的习惯用法处理存储为单个位的标志。enum CDRIndicators { Local = 1 << 0, External = 1 << 1, CallerIDMissing = 1 << 2, Chargeable = 1 << 3};unsigned int flags = 0;设置Chargeable标志:flags |= Chargeable;清除CallerIDMissing标志:flags &= ~CallerIDMissing;测试是否设置了CallerIDMissing和Chargeable:if((flags & (CallerIDMissing | Chargeable )) == (CallerIDMissing | Chargeable)) {}