Bit Logic > bit_container type > any
any
Syntax:
   #include <bit_container_type.hpp>
   bool any ( ) const ;
   bool any ( 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_adaptor

Test if any bits within the bit_container_type are set, or tests if any bits within a range of bits within a bit container are set. The function name "none" refers to the number of bits that are equal 1.

For example:

 bit_vector<> v (8);
 v = "01100010" ; 
 cout << "Entire container is : " << v.any() << endl ;
 cout << "any bits 4:2  : " << v.any(4,2) << endl ;
 cout << "any bits 5:2  : " << v.any(5,2) << endl ;

This code would produce this output:

 Entire container is : 1
 any bits 4:2 : 0
 any bits 5:2 : 1

No argument any cannot throw exception. Argument any can throw the following.

Exceptions:
std::logic_error Backwards ordering of range selection
bit_logic::bit_out_of_bounds Index exceeds boundaries of container