mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-02 11:28:20 +00:00
Improve error reporting when trying to write wchar_t with a char writer
This commit is contained in:
parent
52f44bf114
commit
17b9e4db8c
13
format.h
13
format.h
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user