Having an unsigned long long
how to print it in form of its hex
mask into std::string
?
I tried to iterate over binary (values like 0001
, 0010
, 0100
) mask:
std::stringstream str;
std::string result;
for (unsigned long long mask = 1; mask != 0; mask <<= 1) {
str << mask;
str >> result;
std::cout << result << std::endl;
str.flush();
}
yet I see only values ==
1
(see live sample here).
So I wonder how to print all possible unique bit masks of unsigned long long
?