Skip to content

Commit

Permalink
Rename write_double to write_fp
Browse files Browse the repository at this point in the history
It handles all floating point types, not just doubles.
  • Loading branch information
orivej committed Oct 12, 2019
1 parent 39f76d2 commit a0068d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -1664,11 +1664,11 @@ template <typename Range> 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);
}

/**
Expand All @@ -1678,12 +1678,12 @@ template <typename Range> 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 <typename T, bool USE_GRISU = fmt::internal::use_grisu<T>()>
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) {
Expand Down Expand Up @@ -1830,7 +1830,7 @@ class arg_formatter_base {

template <typename T, FMT_ENABLE_IF(std::is_floating_point<T>::value)>
iterator operator()(T value) {
writer_.write_double(value, specs_ ? *specs_ : format_specs());
writer_.write_fp(value, specs_ ? *specs_ : format_specs());
return out();
}

Expand Down Expand Up @@ -2770,8 +2770,8 @@ struct float_spec_handler {

template <typename Range>
template <typename T, bool USE_GRISU>
void internal::basic_writer<Range>::write_double(T value,
const format_specs& specs) {
void internal::basic_writer<Range>::write_fp(T value,
const format_specs& specs) {
// Check type.
float_spec_handler handler(static_cast<char>(specs.type));
internal::handle_float_type_spec(handler.type, handler);
Expand Down
2 changes: 1 addition & 1 deletion test/locale-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<double, false>(1.23, specs);
w.write_fp<double, false>(1.23, specs);
EXPECT_EQ(fmt::to_string(buf), "1?23");
}

Expand Down

0 comments on commit a0068d7

Please sign in to comment.