diff --git a/format.cc b/format.cc index 76988b49..fc414fac 100644 --- a/format.cc +++ b/format.cc @@ -84,6 +84,7 @@ using fmt::internal::Arg; #if _MSC_VER # pragma warning(push) # pragma warning(disable: 4127) // conditional expression is constant +# pragma warning(disable: 4702) // unreachable code #endif namespace { @@ -239,6 +240,8 @@ void check_sign(const Char *&s, const Arg &arg) { // left alignment if it is negative. class WidthHandler : public fmt::internal::ArgVisitor { private: + WidthHandler& operator=(WidthHandler const&); //no impl + fmt::FormatSpec &spec_; public: @@ -283,6 +286,8 @@ class PrecisionHandler : template class ArgConverter : public fmt::internal::ArgVisitor, void> { private: + ArgConverter& operator=(ArgConverter const&); //no impl + fmt::internal::Arg &arg_; wchar_t type_; @@ -321,6 +326,7 @@ class ArgConverter : public fmt::internal::ArgVisitor, void> { // Converts an integer argument to char for printf. class CharConverter : public fmt::internal::ArgVisitor { private: + CharConverter& operator=(CharConverter const&); // no impl fmt::internal::Arg &arg_; public: @@ -525,6 +531,8 @@ template class fmt::internal::ArgFormatter : public fmt::internal::ArgVisitor, void> { private: + ArgFormatter& operator=(ArgFormatter const&); // no impl + fmt::BasicFormatter &formatter_; fmt::BasicWriter &writer_; fmt::FormatSpec &spec_; diff --git a/format.h b/format.h index 3a2a0439..4fd237fd 100644 --- a/format.h +++ b/format.h @@ -407,14 +407,9 @@ inline int getsign(double value) { return sign; } inline int isinfinity(double x) { return !_finite(x); } +inline int isinfinity( long double x) { return !_finite(static_cast(x)); } #endif -template -struct IsLongDouble { enum {VALUE = 0}; }; - -template <> -struct IsLongDouble { enum {VALUE = 1}; }; - template class BasicCharTraits { public: @@ -996,6 +991,8 @@ class PrintfFormatter : private FormatterBase { template class BasicFormatter : private internal::FormatterBase { private: + BasicFormatter& operator=(BasicFormatter const&); // no impl + BasicWriter &writer_; const Char *start_; @@ -1496,6 +1493,9 @@ class BasicWriter { // Do not implement! void operator<<(typename internal::CharTraits::UnsupportedStrType); + template + Char* append_float_length(Char* format_ptr) { return format_ptr; } + friend class internal::ArgFormatter; friend class internal::PrintfFormatter; @@ -1926,8 +1926,8 @@ void BasicWriter::write_double( *format_ptr++ = '.'; *format_ptr++ = '*'; } - if (internal::IsLongDouble::VALUE) - *format_ptr++ = 'L'; + + format_ptr = append_float_length(format_ptr); *format_ptr++ = type; *format_ptr = '\0'; @@ -1981,6 +1981,16 @@ 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