How to lazily filter an iterator while also applying a function to it

Nonetheless, it can apparently made a difference: See this post. It seems that, at one point at least, the presence of an assert triggers a compiler optimization that wouldn’t be triggered otherwise.