Condividi tramite


bitset::operator|=

Esegue una combinazione bit per bit di bitsets con l'operazione importata OR.

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

Parametri

  • _Right
    Il bitset anziché essere bit per bit combinato con il bitset di destinazione.

Valore restituito

Il bitset di destinazione modificato che deriva dall'operazione inclusa bit per bit OR con il bitset specificato come parametro.

Note

Due bit combinati dall'operatore incluso OR restituiscono true se almeno uno dei bit è true; se entrambi i bit sono false, la combinazione restituisce false.

Bitsets deve essere la stessa dimensione da essere bit per bit combinato con l'operatore OR importato dalla funzione dell'operatore membro.

Esempio

// 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;
}
  
  
  
  

Requisiti

intestazione: <bitset>

Spazio dei nomi: deviazione standard

Vedere anche

Riferimenti

bitset Class