diff --git a/nth/format/common_defaults.h b/nth/format/common_defaults.h index 6603edd..c6d464f 100644 --- a/nth/format/common_defaults.h +++ b/nth/format/common_defaults.h @@ -9,7 +9,7 @@ #include "nth/format/common_formatters.h" #include "nth/meta/type.h" -namespace nth::fmt { +namespace nth { inline word_formatter NthDefaultFormatter( nth::type_tag) { @@ -49,6 +49,6 @@ auto NthDefaultFormatter(nth::type_tag) { return base_formatter(10); } -} // namespace nth::fmt +} // namespace nth #endif // NTH_FORMAT_COMMON_DEFAULTS_H diff --git a/nth/format/common_formatters.h b/nth/format/common_formatters.h index 5c9f348..efe3e21 100644 --- a/nth/format/common_formatters.h +++ b/nth/format/common_formatters.h @@ -1,5 +1,5 @@ -#ifndef NTH_IO_FORMAT_COMMON_FORMATTERS_H -#define NTH_IO_FORMAT_COMMON_FORMATTERS_H +#ifndef NTH_FORMAT_COMMON_FORMATTERS_H +#define NTH_FORMAT_COMMON_FORMATTERS_H #include #include diff --git a/nth/format/format.h b/nth/format/format.h index 6dc851b..54355d5 100644 --- a/nth/format/format.h +++ b/nth/format/format.h @@ -138,9 +138,20 @@ struct structural_formatter { }; template -void NthFormat(nth::io::writer auto& w, F&, T const&) { +void NthFormat(nth::io::writer auto& w, F&, T const& t) { + char buffer[sizeof(T) * 3 + 1]; + buffer[0] = '['; + constexpr std::string_view Hex = "0123456789abcdef"; + char* p = buffer; + for (std::byte b : nth::bytes(t)) { + *++p = Hex[static_cast(b) >> 4]; + *++p = Hex[static_cast(b) & 0x0f]; + *++p = ' '; + } + *p = ']'; + nth::io::write_text(w, std::string_view(nth::type.name())); - nth::io::write_text(w, "?"); + nth::io::write_text(w, std::string_view(buffer, 3 * sizeof(T) + 1)); } } // namespace nth