Add fmt::bytes

This commit is contained in:
Victor Zverovich committed 2019-12-24 10:45:15 -08:00
1 parent dea7fde8b7
commit f219dcd59b
3 files changed
+27 -4

No files matched your search

+16
View File
@@ -3112,6 +3112,22 @@ template <typename T> inline const void* ptr(const std::shared_ptr<T>& p) {
return p.get();
}
class bytes {
private:
string_view data_;
friend struct formatter<bytes>;
public:
explicit bytes(string_view data) : data_(data) {}
};
template <> struct formatter<bytes> : formatter<string_view> {
template <typename FormatContext>
auto format(bytes b, FormatContext& ctx) -> decltype(ctx.out()) {
return formatter<string_view>::format(b.data_, ctx);
}
};
template <typename It, typename Char> struct arg_join : internal::view {
It begin;
It end;