count
Syntax:
   #include <boost/bit_logic/bit_container_type.hpp> 

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

The count() function counts the number of bits set inside of a bit_container.

For example:

 bit_array<9> a ;
 a = "110011001" ; 
 cout << a.count() << endl ;

This code would produce this output:

 5

Count function can throw throw exceptions on empty containers.

Exceptions:
std::logic_error Zero sized bit containers