在枚举中我们经常见到, 如下写法
typedef enum _LHDirection {
LHDirectionNone = 0, LHDirectionTop = 1 << 0, LHDirectionLeft = 1 << 1, LHDirectionRight = 1 << 2, LHDirectionBottom = 1 << 3 } LHDirection;
状态和选项的区别
状态: 同时只能存在一个值
选项: 同时可能存在多个选项
例如: LHDirection direction = LHDirectionTop | LHDirectionBottom; 该值的二进制:00001001
if (direction & LHDirectionTop) { } //判断方向向上时...