[IndVars] Use any_of and foreach instead of explicit for loops; NFC