for (int i = 0; i < foo.count(); ++i) It's generally faster to do: int count = foo.count() for (int i = 0; i < count; ++i) Maybe we could have this check only for containers, and optionally for all functions, because sometimes there are expensive functions.
out of scope, should probably go to clang-tidy