Condividi tramite


bitset::operator==

Verifica un bitset di destinazione per verificare l'uguaglianza con un bitset specificato.

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

Parametri

  • _Right
    Il bitset che deve essere confrontato con il bitset di destinazione per uguaglianza.

Valore restituito

true se i bitsets sono uguali; false se sono diversi.

Note

Bitsets deve essere la stessa dimensione da verificare l'uguaglianza dalla funzione dell'operatore membro.

Esempio

// bitset_op_EQ.cpp
// compile with: /EHsc
#include <bitset>
#include <iostream>

int main( )
{
   using namespace std;
   bitset<5> b1 ( 7 );
   bitset<5> b2 ( 7 );
   bitset<5> b3 ( 2 );
   bitset<4> b4 ( 7 );

   if ( b1 == b2 )
      cout << "Bitset b1 is the same as bitset b2." << endl;
   else
      cout << "Bitset b1 is different from bitset b2." << endl;

   if ( b1 == b3 )
      cout << "Bitset b1 is the same as bitset b3." << endl;
   else
      cout << "Bitset b1 is different from bitset b3." << endl;

   // This would cause an error because bitsets must have the 
   // same size to be tested
   // if ( b1 == b4 )
   //   cout << "Bitset b1 is the same as bitset b4." << endl;
   // else
   //   cout << "Bitset b1 is different from bitset b4." << endl;
}
  
  

Requisiti

intestazione: <bitset>

Spazio dei nomi: deviazione standard

Vedere anche

Riferimenti

bitset Class