Sdílet prostřednictvím


bitset::operator~

Přepíná všechny bity v cílové bitset a vrátí výsledek.

bitset<N> operator~( ) const;

Vrácená hodnota

Bitset s jeho bity přepnuto k cílené bitset.

Příklad

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

int main( )
{
   using namespace std;

   bitset<5> b1 ( 7 );
   bitset<5> b2;
   b2 = ~b1;

   cout << "Bitset b1 is: ( "<< b1 << " )." << endl;
   cout << "Bitset b2 = ~b1 is: ( "<< b2 << " )." << endl;

   // These bits could also be flipped using the flip member function
   bitset<5> b3;
   b3 = b1.flip( );
   cout << "Bitset b3 = b1.flip( ) is: ( "<< b2 << " )." << endl;
}
  
  
  

Požadavky

Záhlaví: <bitset>

Obor názvů: std

Viz také

Referenční dokumentace

bitset Class