Skip to content

Commit

Permalink
Extend basic_writer with write() method for doubles with optional for…
Browse files Browse the repository at this point in the history
…mat_specs argument
  • Loading branch information
chronoxor authored and vitaut committed Mar 26, 2019
1 parent 9e1531c commit e979c78
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -2703,15 +2703,19 @@ template <typename Range> class basic_writer {
write_int(value, s);
}

void write(double value) { write_double(value, format_specs()); }
void write(double value, const format_specs& spec = format_specs()) {
write_double(value, spec);
}

/**
\rst
Formats *value* using the general format for floating-point numbers
(``'g'``) and writes it to the buffer.
\endrst
*/
void write(long double value) { write_double(value, format_specs()); }
void write(long double value, const format_specs& spec = format_specs()) {
write_double(value, spec);
}

/** Writes a character to the buffer. */
void write(char value) {
Expand Down

0 comments on commit e979c78

Please sign in to comment.