c++ 多状态设置
http://blog.csdn.net/wzq9706/article/details/7858711
// 王智泉enum {ST_1 = 0x01 << 1;// 状态1ST_2 = 0x01 << 2;// 状态2ST_3 = 0x01 << 3;// 状态3ST_4 = 0x01 << 4;// 状态4ST_5 = 0x01 << 5;// 状态5};class StateTest{public:StateTest():_state(0){}~StateTest(){}// 设置指定状态// @param tag 状态// @param enable 是否打开void setState(int tag, bool enable){if (enable)_state |= tag;else_state &= ~tag;}// 指定的状态是否打开bool isStateEnable(int tag) const{return (_state & tag) != 0;}private:long long _state;};