Give an error if fill is not convertible to Char in StrFormatSpec

This commit is contained in:
vitaut 2015-06-03 08:39:43 -07:00
parent d8a3b74664
commit 4d521064cf

View File

@ -1305,16 +1305,19 @@ class IntFormatSpec : public SpecT {
}; };
// A string format specifier. // A string format specifier.
template <typename T> template <typename Char>
class StrFormatSpec : public AlignSpec { class StrFormatSpec : public AlignSpec {
private: private:
const T *str_; const Char *str_;
public: public:
StrFormatSpec(const T *str, unsigned width, wchar_t fill) template <typename FillChar>
: AlignSpec(width, fill), str_(str) {} StrFormatSpec(const Char *str, unsigned width, FillChar fill)
: AlignSpec(width, fill), str_(str) {
internal::CharTraits<Char>::convert(FillChar());
}
const T *str() const { return str_; } const Char *str() const { return str_; }
}; };
/** /**
@ -1930,7 +1933,6 @@ class BasicWriter {
template <typename StrChar> template <typename StrChar>
BasicWriter &operator<<(const StrFormatSpec<StrChar> &spec) { BasicWriter &operator<<(const StrFormatSpec<StrChar> &spec) {
const StrChar *s = spec.str(); const StrChar *s = spec.str();
// TODO: error if fill is not convertible to Char
write_str(s, std::char_traits<Char>::length(s), spec); write_str(s, std::char_traits<Char>::length(s), spec);
return *this; return *this;
} }