fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. #include <bitset>
  4.  
  5. template < std::size_t N >
  6. std::string to_text( std::bitset< N > b )
  7. {
  8. return b.any()
  9. ? to_text( b >>= 8 ) + char( b.to_ullong() & 0xff )
  10. : "";
  11. }
  12.  
  13. int main()
  14. {
  15. std::cout << to_text( std::bitset<16> { "0100000101000010" } );
  16. return 0;
  17. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
AB