|
13 | 13 | #include <fmt/format.h>
|
14 | 14 |
|
15 | 15 | template <typename T>
|
16 |
| -struct fmt::formatter<std::optional<T>> : public fmt::formatter<std::decay_t<T>> |
| 16 | +struct fmt::formatter<std::optional<T>> : public fmt::formatter<T> |
17 | 17 | {
|
18 | 18 | template <typename FormatContext>
|
19 |
| - auto format(const std::optional<T>& optional, FormatContext& ctx) const -> decltype(ctx.out()) |
| 19 | + auto format(const std::optional<T>& optional, FormatContext& ctx) -> decltype(ctx.out()) |
20 | 20 | {
|
21 | 21 | if (!optional.has_value())
|
22 | 22 | {
|
23 | 23 | formatter<std::string_view> na;
|
24 | 24 | return na.format("N/A", ctx);
|
25 | 25 | }
|
26 | 26 |
|
27 |
| - return formatter<std::decay_t<T>>::format(optional.value(), ctx); |
| 27 | + return formatter<T>::format(optional.value(), ctx); |
28 | 28 | }
|
29 | 29 | };
|
30 | 30 |
|
31 | 31 | template <typename T>
|
32 |
| -struct fmt::formatter<std::optional<T>, wchar_t> : public fmt::formatter<std::decay_t<T>, wchar_t> |
| 32 | +struct fmt::formatter<std::optional<T>, wchar_t> : public fmt::formatter<T, wchar_t> |
33 | 33 | {
|
34 | 34 | template <typename FormatContext>
|
35 |
| - auto format(const std::optional<T>& optional, FormatContext& ctx) const -> decltype(ctx.out()) |
| 35 | + auto format(const std::optional<T>& optional, FormatContext& ctx) -> decltype(ctx.out()) |
36 | 36 | {
|
37 | 37 | if (!optional.has_value())
|
38 | 38 | {
|
39 | 39 | formatter<std::wstring_view, wchar_t> na;
|
40 | 40 | return na.format(L"N/A", ctx);
|
41 | 41 | }
|
42 | 42 |
|
43 |
| - return formatter<std::decay_t<T>, wchar_t>::format(optional.value(), ctx); |
| 43 | + return formatter<T, wchar_t>::format(optional.value(), ctx); |
44 | 44 | }
|
45 | 45 | };
|
0 commit comments