Sdílet prostřednictvím


bitset::operator&=

Provádí bitovou kombinaci bitsets s logickým a operace.

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

Parametry

  • _Right
    Bitset, že bitové kombinovat s bitset cíl.

Vrácená hodnota

Bitset upravený cíl, který je výsledkem bitové a operace s bitset zadán jako parametr.

Poznámky

Kombinovány dva bity a vratky operátor true pokud každý bit je true; jinak vrátí jejich kombinaci false.

Musí být stejné velikosti bitové kombinovat s Bitsets a operátor operátor členské funkce.

Příklad

// bitset_op_bitwise.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 AND combination,\n"
        << " the target bitset b1 becomes:   ( "<< b1 << " )." 
        << endl;

   // Note that the parameter-specified bitset is 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;
}
  
  
  
  

Požadavky

Záhlaví: <bitset>

Obor názvů: std

Viz také

Referenční dokumentace

bitset Class