I agree with @andlaus that size_t is acceptable. No it is not guaranteed to be the same as the return value from the size() call in question, but it is an unsigned type, which is what matters here. If ever the container size types change to something larger than 64 bit unsigned integers, it may be too small in some cases, but I honestly do not think that is reason to worry (we already use `int` for many such purposes, making them all `long int` may be a good idea for a future refactoring btw...).

I agree with @bska that correctness matters. But the proposed code is not incorrect.