OR の包括操作と bitsets のビットごとの組み合わせに実行します。
bitset<N>& operator|=(
const bitset<N>& _Right
);
パラメーター
- _Right
ターゲットの bitset およびビットごとに結合する bitset。
戻り値
パラメーターとして指定された bitset との OR のビットごとの包括的操作によって生成される変更されたターゲットの bitset。
解説
OR の包括演算子は結合する 2 ビットはビットが少なくとも 1 つが true場合はを返します true ; ビットが両方とも false場合、false組み合わせはを返します。
Bitsets はメンバー演算子の関数によって OR の包括ビット処理演算子と結合する同じサイズである必要があります。
使用例
// bitset_op_BIO.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 inclusive 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