-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPartial.fmt.h
More file actions
24 lines (21 loc) · 812 Bytes
/
Partial.fmt.h
File metadata and controls
24 lines (21 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once
#include "Partial.h"
/// note: for this header you need fmt library (not included as library dependency)
#include <fmt/format.h>
template<class... Ts, class Char> struct fmt::formatter<partial19::Partial<Ts...>, Char> {
constexpr auto parse(fmt::basic_format_parse_context<Char>& ctx) { return ctx.begin(); }
template<class FormatContext> auto format(partial19::Partial<Ts...> const& t, FormatContext& ctx) const {
bool first = true;
auto out = ctx.out();
t.visitInitialized([&](auto& v) {
if (first) {
out = fmt::format_to(out, "<[{}", v);
first = false;
}
else {
out = fmt::format_to(out, "; {}", v);
}
});
return fmt::format_to(out, "]>");
}
};