|
select
Syntax:
#include <boost/bit_logic/bit_container.hpp> bit_handle select ( size_type bit_idx ) ; bit_handle select ( 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_adaptorThe select() function returns a bit_handle, which is a class that refers to some individual bit, or range of bits within a bit container. The bit_handle object has all the same functions as a bit_container. For example: bit_vector<> v (9, true); cout << v.select(4) << endl ; v.select(7,1).flip(); cout << v << endl ; v.select(6,2).flip(); cout << v << endl ; v.select(5,3).flip(); cout << v << endl ; v.select(4).flip(); cout << v << endl ; This code would produce this output: 1 100000001 101111101 101000101 101010101 Arguments out of range or in wrong order throw exceptions. Exceptions:
|