|
flip
Syntax:
#include <boost/bit_logic/bit_container_type.hpp> void flip ( ) ; void flip ( size_type bit_idx ) ; void flip ( size_type upper_bit_idx , size_type lower_bit_idx ) ; Note: These functions are equivelant for all bit_container types. bit_array<N>, bit_vector, bit_container_adaptorThe flip() function inverts bit elements within a bit container. The no argument function flips every bit, the single argument version only flips the bit at a given index, and the multi-argument function flips the bits within the closed range of bit elements of a bit container. For example: bit_vector<> v (9); // could also be a bit_array<9> cout << v << endl ; v.flip(); cout << v << endl ; v.flip(7,1); cout << v << endl ; v.flip(6,2); cout << v << endl ; v.flip(5,3); cout << v << endl ; v.flip(4); cout << v << endl ; This code would produce this output: 000000000 111111111 100000001 101111101 101000101 101010101 No argument flip throws no exceptions. Single argument flip can throw bit_out_of_bounds, and two argument flip can throw any of the following. Exceptions:
|