问题描述
我想知道向fmt::formatter::format
添加任意文本的正确方法是什么。基本上,我想为我的对象命名。当前的实现可行,但是我不确定是否可以做得更好,而且我感觉我的垂直对齐技巧可以做得更好。
namespace fmt {
template <>
struct formatter<Experiment> {
constexpr auto parse(format_parse_context& ctx) {
return ctx.begin();
}
template <typename FormatContext>
auto format(const Experiment& e,FormatContext& ctx) {
ctx.out() = format_to(ctx.out(),"Experiment:\n\t\t\t\t");
return format_to(ctx.out(),"{}",join(e.begin(),e.end(),"\n\t\t\t\t"));
}
};
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)