Bit Logic > bit_container > find_next
find_next
Syntax:
   #include <boost/bit_logic/bit_container_type.hpp> 
   std::size_t find_next ( std::size_t idx ) ; 

Note: These functions are equivelant for all bit_container types. bit_array<N>, bit_vector, bit_container_adaptor

The find_next() function returns the index of the first bit set after idx in the bit_container_type, if no bits are set in bit_container, then the value returned is bit_container::npos.

Nota Bene: bit_handles will only search the size of the bit_handle for a value set to 1. any bit set outside of the range selected by the bit handle will not be checked.

For example:

 bit_vector<> v (9); // could also be a bit_array<9>
 v = "110001000" ; 
 cout << "Next found after 2 : " << v.find_next(2) << endl ;
 cout << "Checking subrange for bits : " << ( ( v.select(6,3).find_next(0) == bit_vector<>::npos ) ? "not-found" : "found" ) ; 
 v.find_next();

This code would produce this output:

 Next found after 2 : 3
 Checking subrange for bits : not-found

No exceptions are thrown.