开发者

How can I use std::hex for my custom uint128 type?

开发者 https://www.devze.com 2023-03-09 23:20 出处:网络
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_tstd::h

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消