From a0068d7e7f37d71c49805a8cfb426a49d1c81314 Mon Sep 17 00:00:00 2001 From: Orivej Desh Date: Sat, 12 Oct 2019 03:38:31 +0000 Subject: [PATCH] Rename write_double to write_fp It handles all floating point types, not just doubles. --- include/fmt/format.h | 14 +++++++------- test/locale-test.cc | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index c8bf2e9cb590..12bf0f48d215 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1664,11 +1664,11 @@ template class basic_writer { } void write(float value, const format_specs& specs = format_specs()) { - write_double(value, specs); + write_fp(value, specs); } void write(double value, const format_specs& specs = format_specs()) { - write_double(value, specs); + write_fp(value, specs); } /** @@ -1678,12 +1678,12 @@ template class basic_writer { \endrst */ void write(long double value, const format_specs& specs = format_specs()) { - write_double(value, specs); + write_fp(value, specs); } // Formats a floating-point number (float, double, or long double). template ()> - void write_double(T value, const format_specs& specs); + void write_fp(T value, const format_specs& specs); /** Writes a character to the buffer. */ void write(char value) { @@ -1830,7 +1830,7 @@ class arg_formatter_base { template ::value)> iterator operator()(T value) { - writer_.write_double(value, specs_ ? *specs_ : format_specs()); + writer_.write_fp(value, specs_ ? *specs_ : format_specs()); return out(); } @@ -2770,8 +2770,8 @@ struct float_spec_handler { template template -void internal::basic_writer::write_double(T value, - const format_specs& specs) { +void internal::basic_writer::write_fp(T value, + const format_specs& specs) { // Check type. float_spec_handler handler(static_cast(specs.type)); internal::handle_float_type_spec(handler.type, handler); diff --git a/test/locale-test.cc b/test/locale-test.cc index 37d4687bb3c8..911da6e16b08 100644 --- a/test/locale-test.cc +++ b/test/locale-test.cc @@ -23,7 +23,7 @@ TEST(LocaleTest, DoubleDecimalPoint) { fmt::internal::writer w(buf, fmt::internal::locale_ref(loc)); auto specs = fmt::format_specs(); specs.type = 'n'; - w.write_double(1.23, specs); + w.write_fp(1.23, specs); EXPECT_EQ(fmt::to_string(buf), "1?23"); }