[Issue 24152] range .until evaluates .front twice

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 20 01:46:17 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=24152

--- Comment #1 from Jan Jurzitza <d.bugs at webfreak.org> ---
`std.algorithm:cache` could be used, but that still evalutes .front one time
too many compared to when `until` should stop when No.openRight is passed in as
argument, e.g.

```
iota(10).map!logAccess.cache.until(5, No.openRight).array;
```

will call logAccess on 0, 1, 2, 3, 4, 5 and 6

--


More information about the Digitalmars-d-bugs mailing list