Flip a bitset : bitset flip « bitset « C++ Tutorial






#include <bitset>
#include <iostream>

using namespace std;

int main( ){
   const int num_lights = 15;
   const bitset<num_lights> outside( 0xf );
   const bitset<num_lights> inside( 0xff0 );
   const bitset<num_lights> driveway( 0x7000 );

   bitset<num_lights> lights;

   lights &= bitset<num_lights>( inside ).flip();
   cout << lights;

}








18.4.bitset flip
18.4.1.flip the bits
18.4.2.Flip a bitset