Bit Logic > functions > Operators
Operators
Syntax:
 #include <boost/bit_logic/bit_io.hpp> 
 basic_istream<CharT,TraitsT> & operator<< ( BitContainerT & bits, basic_istream<CharT,TraitsT> & is ) ;
 basic_ostream<CharT,TraitsT> & operator>> ( basic_ostream<CharT,TraitsT> & is, BitContainerT const & bits ) ;	

Stream operators are used for inputting and outputting data from a Bit Container.

 stringstream foo ; 
 foo << "1000110" ; 
 bit_vector<> bits ( 7 ) ; 
 bits << foo ; 
 cout << bits << endl ; 
 foo.clear() ;
 foo << hex << "7f" ; 
 bits >> foo ; 
 cout << hex << bits << endl ; 

This code would produce this output:

 1000110
 7f

ostream operator can throws no exceptions.

istream operator can throw :

Exceptions:
std::logic_error Illegal Character sequences
bit_logic::bit_out_of_bounds Bits defined in argument exceed the boundaries of the container to which they are being assinged.