The problem is that comparisons with signed and unsigned integers (where the unsigned type is not smaller than the signed type and not smaller than int) will lead to the signed type being converted to the unsigned type before the comparison takes place. This leads to problems if the signed integer variable can be negative.
Example:
1 2 3 4 5 6 7 8 9 10 11
unsignedint uint = 0;
signedint sint = -1;
if (sint < uint)
{
std::cout << sint << " is less than " << uint << ".\n";
}
else
{
std::cout << sint << " is greater than or equal to " << uint << ".\n";
}
The example above will print "-1 is greater than or equal to 0." which is clearly not what one would expect. The reason is because sint is automatically converted to an unsigned int (same type as uint) before being compared, and converting a negative signed value to an unsigned type ends up with a very big positive value.
This is not really a problem in the code that you posted because values are never negative but it is still a useful warning to have, I wouldn't disable it and I wouldn't ignore it, so a way around this is to use std::size_t (or some other unsigned integer type) for the indices when looping over a container.
Another approach that some prefer is to convert the size to a signed type before doing anything with it. This could be done using an explicit cast or a helper function such as std::ssize which was introduced in C++20 (before that you could easily write such a helper function yourself).