Bit Logic > functions > reset_bits
reset_bits
Syntax:
  #include <boost/bit_logic/functions.hpp> 
  void reset_bit ( BitStorage bit_store, size_type bit_idx ) ; 
  void reset_bits ( BitStorage bit_store, size_type upper_bit_idx, size_type lower_bit_idx ) ; 

The reset_bits functions are used to reset to 0 any bits within a Bit Storage type. The naming diffence is used to denote setting of 1 bit within a Bit Storage type versus setting a sequence of bits.

Note Bene : I really dislike the name of this function. But I attempted to keep name continuity with boost::dynamic_bitset for all functions that set to 0 a value i n BitLogic. Unfortunately the term "clear", which would be an antonym for set is already used for modifying the size of containers in Standard C++, so the term reset it used.

For example:

  uint16_t test = 0x1 ; 
  reset_bit ( test, 0 ) ; 
  cout << test << endl ;
  test = 0xff ;							
  reset_bits ( test, 7, 1 ) ;
  cout << test << endl ;

This code will output:

  0
  1

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