mirror of
https://github.com/fmtlib/fmt.git
synced 2025-01-13 09:36:32 +00:00
Remove old msvc workaround from arg_formatter_base and fix warning
This commit is contained in:
parent
d32fe0f3f6
commit
d05d42751c
@ -1423,20 +1423,24 @@ class arg_formatter_base {
|
|||||||
return out();
|
return out();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value ||
|
template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
|
||||||
std::is_same<T, char_type>::value)>
|
|
||||||
iterator operator()(T value) {
|
iterator operator()(T value) {
|
||||||
// MSVC2013 fails to compile separate overloads for bool and char_type so
|
if (specs_)
|
||||||
// use std::is_same instead.
|
writer_.write_int(value, *specs_);
|
||||||
if (std::is_same<T, bool>::value) {
|
else
|
||||||
if (specs_ && specs_->type) return (*this)(value ? 1 : 0);
|
writer_.write(value);
|
||||||
write(value != 0);
|
return out();
|
||||||
} else if (std::is_same<T, char_type>::value) {
|
}
|
||||||
internal::handle_char_specs(
|
|
||||||
specs_, char_spec_handler(*this, static_cast<char_type>(value)));
|
iterator operator()(char_type value) {
|
||||||
} else {
|
internal::handle_char_specs(
|
||||||
specs_ ? writer_.write_int(value, *specs_) : writer_.write(value);
|
specs_, char_spec_handler(*this, static_cast<char_type>(value)));
|
||||||
}
|
return out();
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator operator()(bool value) {
|
||||||
|
if (specs_ && specs_->type) return (*this)(value ? 1 : 0);
|
||||||
|
write(value != 0);
|
||||||
return out();
|
return out();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2494,7 +2494,9 @@ TEST(FormatTest, CharTraitsIsNotAmbiguous) {
|
|||||||
struct mychar {
|
struct mychar {
|
||||||
int value;
|
int value;
|
||||||
mychar() = default;
|
mychar() = default;
|
||||||
mychar(char val) : value(val) {}
|
|
||||||
|
template <typename T> mychar(T val) : value(static_cast<int>(val)) {}
|
||||||
|
|
||||||
operator int() const { return value; }
|
operator int() const { return value; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user