C++中对一个布尔类型的变量按位取反结果不变

C++中对一个bool类型的变量按位取反是无效的。例如:

bool a = true;
bool b = ~a; // b的值还是true

猜你喜欢

转载自www.cnblogs.com/cngpus/p/13188567.html
今日推荐