How can I use std::hex for my custom uint128 type?
What is the correct syntax to overload (or whatever is actually is) std::hex
, so that its fun开发者_运维问答ctionality can be extended to non standard integers? i wrote this version of uint128_t
std::hex is just a manipulator which set some of the formatting flags on the stream. You can get them using ios_base::flags() and use the result in your operator<<. You probably should also use ios_base::width and ios_base::precision.
If you want more settings than what is provided, ios_base::xalloc, ios_base::iword, ios_base::pword furnish a path to extensions for your manipulators and insertors.
精彩评论