C++ boost::utility::BOOST_BINARY














































C++ boost::utility::BOOST_BINARY



INTRODUCTION:
Since standard C++ only supports hexadecimal and octal forms, using the prefixes 0x and 0C++11 introduced the macro BOOST_BINARY that lets us create numbers in binary form.

HEADER FILE:
boost/utility/binary.hpp

SYNTAX:
datatype vaiableName=BOOST_BINARY(number); 
where number is the binary equivalent of a decimal number.

SAMPLE PROGRAM:
#include <boost/utility/binary.hpp>
#include <iostream>
using namespace std;
int main()
{
int i = BOOST_BINARY(1001 0001);
cout << i << endl ;
return 0;
}

OUTPUT:

In the above example, the binary number1001 0001 refers to 145 in decimal form.


Comments