Improve error reporting when trying to write wchar_t with a char writer

This commit is contained in:
Victor Zverovich 2015-02-26 06:21:54 -08:00
parent 52f44bf114
commit 17b9e4db8c

View File

@ -1610,11 +1610,13 @@ class BasicWriter {
void write_str( void write_str(
const internal::Arg::StringValue<StrChar> &str, const FormatSpec &spec); const internal::Arg::StringValue<StrChar> &str, const FormatSpec &spec);
// This method is private to disallow writing a wide string to a // This following methods are private to disallow writing wide characters
// char stream and vice versa. If you want to print a wide string // and strings to a char stream. If you want to print a wide string as a
// as a pointer as std::ostream does, cast it to const void*. // pointer as std::ostream does, cast it to const void*.
// Do not implement! // Do not implement!
void operator<<(typename internal::CharTraits<Char>::UnsupportedStrType); void operator<<(typename internal::CharTraits<Char>::UnsupportedStrType);
void operator<<(typename internal::WCharHelper<wchar_t, Char>::Unsupported);
// Appends floating-point length specifier to the format string. // Appends floating-point length specifier to the format string.
// The second argument is only used for overload resolution. // The second argument is only used for overload resolution.
@ -1744,8 +1746,9 @@ class BasicWriter {
return *this; return *this;
} }
BasicWriter &operator<<(wchar_t value) { BasicWriter &operator<<(
buffer_.push_back(internal::CharTraits<Char>::convert(value)); typename internal::WCharHelper<wchar_t, Char>::Supported value) {
buffer_.push_back(value);
return *this; return *this;
} }