I did below:
if( '0' <= infix.at(i)<= '9'){
// some logic
}
Compiler gave me warning unsafe use of type ‘bool’ in operation. I changed it to following:
if( '0' <= infix.at(i)&& infix.at(i) <= '9')
now it works. Is the first one not allowed in C++??
The first version would be evaluated like this:
which is why you get a warning about
bool– you wind up withtrue/false <= '9'which doesn’t make sense.Some languages allow you to chain comparison operators, but C++ is not one of them.