From 54f19ff7b2ea67c88b8dde46aa190f29cb9ba8aa Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 3 Dec 2014 06:33:31 -0800 Subject: [PATCH] Simplify append_float_length --- format.h | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/format.h b/format.h index 97e176b0..a1218232 100644 --- a/format.h +++ b/format.h @@ -1493,8 +1493,14 @@ class BasicWriter { // Do not implement! void operator<<(typename internal::CharTraits::UnsupportedStrType); + // Appends floating-point length specifier to the format string. + // The second argument is only used for overload resolution. + void append_float_length(Char *&format_ptr, long double) { + *format_ptr++ = 'L'; + } + template - Char* append_float_length(Char* format_ptr) { return format_ptr; } + void append_float_length(Char *&, T) {} friend class internal::ArgFormatter; friend class internal::PrintfFormatter; @@ -1927,7 +1933,7 @@ void BasicWriter::write_double( *format_ptr++ = '*'; } - format_ptr = append_float_length(format_ptr); + append_float_length(format_ptr, value); *format_ptr++ = type; *format_ptr = '\0'; @@ -1981,16 +1987,6 @@ void BasicWriter::write_double( } } -template <> template <> inline char* BasicWriter::append_float_length( char* format_ptr) { - *format_ptr++ = 'L'; - return format_ptr; -} - -template <> template <> inline wchar_t* BasicWriter::append_float_length( wchar_t* format_ptr) { - *format_ptr++ = 'L'; - return format_ptr; -} - /** \rst This template provides operations for formatting and writing data into