diff --git a/format.ipp b/format.ipp index c3944bf1..cae1712e 100644 --- a/format.ipp +++ b/format.ipp @@ -68,14 +68,14 @@ namespace util { template <> inline bool is_type_specifier (const char *s) - { return *s == 'u'; } + { return *s == 'u' || *s == 'x'; } //--------------------------------------------------------------------- template <> inline bool is_type_specifier (const char *s) - { return *s == 'u'; } + { return *s == 'u' || *s == 'x'; } //--------------------------------------------------------------------- @@ -83,7 +83,7 @@ namespace util { inline bool is_type_specifier (const char *s) { - return *s == 'i' || *s == 'd'; + return *s == 'i' || *s == 'd' || *s == 'x'; } @@ -160,7 +160,10 @@ namespace util { if (!is_valid_specifier::type> (&*spec)) throw util::format::format_error ("invalid/unhandled format specifier"); - dest << val; + if (*spec == 'x') { + dest << std::hex << val << std::dec; + } else + dest << val; render (spec + 1, last, dest, std::forward (args)...); }