我有一组可用的枚举选项。
我希望您能根据用户的输入,在执行它们之前切换它们的开关状态。
例如:
typdef enum {
option1 = 1 << 0,
option2 = 1 << 1,
option3 = 1 << 2,
} availableOptions;
我希望您能根据用户的输入,在执行它们之前切换它们的开关状态。
例如:
// iniatially set to all options
myOption = option1 | option2 | option3;
// 用户输入后
void toggleOption1()
{
// how can I toggle an option that was already set without impacting the other options
}
oldOptions ^ newOptions
也会告诉你哪些选项被翻转了。 - godel9