How to prevent type instability in for loops?

AFAIU, this “type instability” is harmless. It is a consequence of the iterator interface which returns nothing when the end of the iterator is reached. Note that the line you cited from the @code_warntype output is colored in yellow (not red, which indicates “true” type instabilities).

1 Like