I\'m noticing that cout << hex
is giving me strange results, and I cannot find anywhere that answers why. What I am doing is simply assigning some values to
std::uint8_t
is an alias for unsigned char
:
typedef unsigned char uint8_t;
So the overload of the inserter that takes a char&
is chosen, and the ASCII representation of 0xab
is written, which could technically vary by your operating system, as 0xab
is in the range of Extended ASCII.
You have to cast it to an integer:
std::cout << std::hex << static_cast(a) << std::endl;