本文介绍了什么是& =和| =的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在大型代码库中浏览一些VC ++代码,并遇到了这个问题:
I was going through some VC++ code in a large code-base and came across this:
if (nState & TOOL_TIPS_VISIBLE)
nState &= ~TOOL_TIPS_VISIBLE;
else
nState |= TOOL_TIPS_VISIBLE;
break;
在C ++中是否有& =或| =这样的运算符?它是做什么用的?
等于nState = nState & ~TOOL_TIPS_VISIBLE
吗?
Is there any such operator as &= or |= in C++? What is it for?
Is it the equivalent of nState = nState & ~TOOL_TIPS_VISIBLE
?
推荐答案
x &= y
与x = x & y
相同x |= y
与x = x | y
x &= y
is the same as x = x & y
x |= y
is the same as x = x | y
这篇关于什么是& =和| =的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!