File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -207,19 +207,31 @@ struct hash<boxed::detail::boxed<T, U>>
207
207
} // namespace std
208
208
// {{{ fmtlib integration
209
209
// clang-format off
210
- #if __has_include(<fmt/format.h>)
210
+ #if __has_include(<format>)
211
+ #include < format>
212
+ // clang-format on
211
213
214
+ template <typename Type, typename Tag>
215
+ struct std ::formatter<boxed::detail::boxed<Type, Tag>>: std::formatter<Type>
216
+ {
217
+ template <typename FormatContext>
218
+ auto format (boxed::detail::boxed<Type, Tag> const & val, FormatContext& ctx) const
219
+ {
220
+ return std::formatter<Type>::format (val.value , ctx);
221
+ }
222
+ };
223
+ #elif __has_include(<fmt/format.h>)
224
+
225
+ // clang-format off
212
226
#include < fmt/format.h>
213
227
// clang-format on
214
228
215
229
template <typename Type, typename Tag>
216
- struct fmt ::formatter<boxed::detail::boxed<Type, Tag>>
230
+ struct fmt ::formatter<boxed::detail::boxed<Type, Tag>>: fmt::formatter<Type>
217
231
{
218
- constexpr auto parse (fmt::format_parse_context& ctx) { return ctx.begin (); }
219
-
220
232
auto format (boxed::detail::boxed<Type, Tag> const & val, fmt::format_context& ctx) const
221
233
{
222
- return fmt::format_to (ctx. out (), " {} " , val.value );
234
+ return fmt::formatter<Type>:: format ( val.value , ctx );
223
235
}
224
236
};
225
237
You can’t perform that action at this time.
0 commit comments