Bit Logic > assign > flip
flip
Syntax:
  #include <boost/bit_logic/assign.hpp> 
  bit_flip_functor flip ( BitType bits ) ; 

The flip function returns a functor object whose operator() member functions are used to call flip on ranges of bit within its constructed Bit Type. Flipping of bits is evaluated left-to-right as with any chained.

For example:

  uint16_t test = 0xf015 ; 
  flip(test)(15,12)(8)(2)(0) ; 
  cout << hex << test << endl ;

This code will output:

  0000

This syntactic form can also be used for single bit assginments.

This code can throw the following exceptions :

Exceptions:
std::logic_error index range incorrect
bit_logic::out_of_bounds Indexing out of bounds of bit_storage type
bit_logic::runtime_error functor object destruction with out any operator's being called