[Solved] std::min is not returning the smaller of two values [closed]


This can only happen if x and y are unsigned types and one of them is zero.

Subtracting 1 from an unsigned value 0 will cause an unsigned value to wrap around to the largest possible value for that type. Hence the other value will be smaller.

As a side note: only blame your compiler / STL as a very last resort.

5

solved std::min is not returning the smaller of two values [closed]