bitset::operator^=

OR の排他的な操作と bitsets のビットごとの組み合わせに実行します。

bitset<N>& operator^=(
   const bitset<N>& _Right
);

パラメーター

  • _Right
    ターゲットの bitset およびビットごとに結合する bitset。

戻り値

パラメーターとして指定された bitset との OR のビットごとの排他的な操作で発生する変更されたターゲットの bitset。

解説

排他アクセスを OR の演算子で結合する 2 ビットはビットが少なくとも 1 ビット、両方が、trueであるを返します 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

参照

関連項目

bitset Class