Replace buffer with range

This commit is contained in:
Victor Zverovich
2018-01-10 22:41:23 -08:00
parent c3d6c5fc4c
commit c095445394
14 changed files with 544 additions and 555 deletions
+5 -5
View File
@@ -14,18 +14,18 @@ using fmt::printf_arg_formatter;
// A custom argument formatter that doesn't print `-` for floating-point values
// rounded to 0.
class CustomArgFormatter : public fmt::arg_formatter<char> {
class CustomArgFormatter : public fmt::arg_formatter<fmt::buffer> {
public:
CustomArgFormatter(fmt::buffer &buf, fmt::basic_context<char> &ctx,
CustomArgFormatter(fmt::buffer &buf, fmt::basic_context<fmt::buffer> &ctx,
fmt::format_specs &s)
: fmt::arg_formatter<char>(buf, ctx, s) {}
: fmt::arg_formatter<fmt::buffer>(buf, ctx, s) {}
using fmt::arg_formatter<char>::operator();
using fmt::arg_formatter<fmt::buffer>::operator();
void operator()(double value) {
if (round(value * pow(10, spec().precision())) == 0)
value = 0;
fmt::arg_formatter<char>::operator()(value);
fmt::arg_formatter<fmt::buffer>::operator()(value);
}
};