Use textual representation for bool by default (#170)

This commit is contained in:
vitaut
2015-06-11 09:00:06 -07:00
parent fd5c2e909b
commit 9d09214e7a
5 changed files with 32 additions and 9 deletions
+10
View File
@@ -653,6 +653,16 @@ class fmt::internal::ArgFormatter :
template <typename T>
void visit_any_double(T value) { writer_.write_double(value, spec_); }
void visit_bool(bool value) {
if (spec_.type_) {
writer_.write_int(value, spec_);
return;
}
const char *str_value = value ? "true" : "false";
Arg::StringValue<char> str = { str_value, strlen(str_value) };
writer_.write_str(str, spec_);
}
void visit_char(int value) {
if (spec_.type_ && spec_.type_ != 'c') {
spec_.flags_ |= CHAR_FLAG;