mirror of
https://github.com/fmtlib/fmt.git
synced 2025-11-28 21:30:00 +01:00
Fix formatting of bool with FMT_COMPILE and add more tests
This commit is contained in:
@@ -3380,7 +3380,8 @@ inline std::string to_string(const T& value) {
|
||||
}
|
||||
template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
|
||||
inline std::string to_string(T value) {
|
||||
char buffer[detail::digits10<T>() + 2];
|
||||
// Buffer should be large enough to store the number or "false" (for bool).
|
||||
char buffer[(std::max)(detail::digits10<T>() + 2, 5)];
|
||||
char* begin = buffer;
|
||||
char* end = detail::write<char>(begin, value);
|
||||
return std::string(begin, end);
|
||||
|
||||
Reference in New Issue
Block a user