按位运算bitsets的组合用独占 OR 操作。
bitset<N>& operator^=(
const bitset<N>& _Right
);
参数
- _Right
将按位组合与目标bitset的bitset。
返回值
由为参数指定的bitset的位独占 OR 操作的修改后的目标bitset。
备注
如果至少一,但是,不是两个位,是 true,排除 OR 运算符组合的两个返回 true ;否则,其组合返回 false。
Bitsets必须将按位组合的大小相同的独占 OR 运算符按成员运算符函数。
示例
// bitset_op_bitwiseOR.cpp
// compile with: /EHsc
#include <bitset>
#include <iostream>
int main( )
{
using namespace std;
bitset<5> b1 ( 7 );
bitset<5> b2 ( 11 );
bitset<4> b3 ( 7 );
cout << "The target bitset b1 is: ( "<< b1 << " )." << endl;
cout << "The parameter bitset b2 is: ( "<< b2 << " )." << endl;
cout << endl;
b1 ^= b2;
cout << "After bitwise exclusive OR combination,\n"
<< " the target bitset b1 becomes: ( "<< b1 << " )."
<< endl;
// Note that the parameter-specified bitset in unchanged
cout << "The parameter bitset b2 remains: ( "<< b2 << " )."
<< endl;
// The following would cause an error because the bisets
// must be of the same size to be combined
// b1 |= b3;
}
要求
标头: <bitset>
命名空间: std