The function std::isdigit is:
int isdigit(int ch);
The return (Non-zero value if the character is a numeric character, zero otherwise.) s
The reaons is to allow EOF as input. And EOF is (from here):
EOF
EOF integer constant expression of type int and negative value