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

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

The find_first() function returns the index of the first bit set to 1 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 << "First found is : " << v.find_first() << endl ;						  
 v.find_first();

This code would produce this output:

 Found first is : 3

No exceptions are thrown.