I have the following code snippet:
cout << indexCoveredA[a.size()-1] << " "<< b.size()-1 << endl;
if (indexCoveredA[a.size()-1] < (b.size() - 1) ) {
cout << "entered";
}
Where a
, b
, indexCoveredA
and indexCoveredB
are std::vector<int>
.
When I run this code, the console prints:
-1 4
This means that in the if condition, LHS is less than RHS. However "entered" is not printed, which means that the if condition is evaluated to be false.
Now if I change the condition to (indexCoveredA[a.size()-1] + 1 < b.size() )
, then "entered" is printed in the console.
I have tried this out with MSVC and minGW compilers. I am not able to understand why this is so.
Can someone please explain?
Thanks.