diff --git a/format.cc b/format.cc index 3f5d8080..3f62bcc5 100644 --- a/format.cc +++ b/format.cc @@ -179,11 +179,11 @@ const uint64_t fmt::internal::POWERS_OF_10_64[] = { void fmt::internal::ReportUnknownType(char code, const char *type) { if (std::isprint(static_cast(code))) { throw fmt::FormatError(fmt::str( - fmt::Format("unknown format code '{}' for {}") << code << type)); + fmt::format("unknown format code '{}' for {}", code, type))); } throw fmt::FormatError( - fmt::str(fmt::Format("unknown format code '\\x{:02x}' for {}") - << static_cast(code) << type)); + fmt::str(fmt::format("unknown format code '\\x{:02x}' for {}", + static_cast(code), type))); } #ifdef _WIN32 @@ -569,11 +569,11 @@ void fmt::BasicWriter::FormatParser::CheckSign( char sign = static_cast(*s); if (arg.type > Arg::LAST_NUMERIC_TYPE) { report_error_(s, - fmt::Format("format specifier '{}' requires numeric argument") << sign); + fmt::c_str(fmt::format("format specifier '{}' requires numeric argument", sign))); } if (arg.type == Arg::UINT || arg.type == Arg::ULONG_LONG) { report_error_(s, - fmt::Format("format specifier '{}' requires signed argument") << sign); + fmt::c_str(fmt::format("format specifier '{}' requires signed argument", sign))); } ++s; } diff --git a/format.h b/format.h index 0656a364..dcc529ab 100644 --- a/format.h +++ b/format.h @@ -859,7 +859,9 @@ inline StrFormatSpec pad( return StrFormatSpec(str, width, fill); } -// An argument list. +/** + An argument list. + */ class ArgList { private: const internal::ArgInfo *args_; @@ -1398,17 +1400,21 @@ class BasicWriter { // This function is deprecated, use write instead. FMT_DEPRECATED(void Write(const std::basic_string &s, const FormatSpec &spec)); - void Write(const std::basic_string &s, const FormatSpec &spec) { - write(s, spec); - } void clear() { buffer_.clear(); } // This function is deprecated, use clear instead. FMT_DEPRECATED(void Clear()); - void Clear() { clear(); } }; +template +inline void BasicWriter::Write(const std::basic_string &s, const FormatSpec &spec) { + write(s, spec); +} + +template +inline void BasicWriter::Clear() { clear(); } + template template typename BasicWriter::CharPtr BasicWriter::FormatString( @@ -1595,7 +1601,7 @@ namespace internal { // Formats an argument of a custom type, such as a user-defined class. template void FormatCustomArg(void *writer, const void *arg, const FormatSpec &spec) { - Format(*static_cast*>(writer), + format(*static_cast*>(writer), spec, *static_cast(arg)); } } @@ -1823,9 +1829,8 @@ inline Formatter<> Format(StringRef format) { return f; } - // This function is deprecated, use format instead. -FMT_DEPRECATED(Formatter Format(WStringRef format)); +Formatter FMT_DEPRECATED(Format(WStringRef format)); inline Formatter Format(WStringRef format) { Formatter f(format); return f;