Count sign as part of the character count.

This commit is contained in:
Howard Hinnant 2023-12-11 21:33:25 -05:00
parent 0ef86f1ced
commit ab37c362e3

View File

@ -6351,7 +6351,10 @@ read_signed(std::basic_istream<CharT, Traits>& is, unsigned m = 1, unsigned M =
if (('0' <= c && c <= '9') || c == '-' || c == '+') if (('0' <= c && c <= '9') || c == '-' || c == '+')
{ {
if (c == '-' || c == '+') if (c == '-' || c == '+')
{
(void)is.get(); (void)is.get();
--M;
}
auto x = static_cast<int>(read_unsigned(is, std::max(m, 1u), M)); auto x = static_cast<int>(read_unsigned(is, std::max(m, 1u), M));
if (!is.fail()) if (!is.fail())
{ {