On Sunday, 15 April 2018 at 06:39:43 UTC, Jonathan M Davis wrote:
On Sunday, April 15, 2018 07:26:54 Shachar Shemesh via Digitalmars-d wrote:
[...]

It's extremely common for range-based functions to copy front. Even foreach does it. e.g.

[...]


Arguably it should “move” them.

This would have worked if input ranges didn’t have to cache front to support multiple ‘front’ calls before popFront. Which is a painful misfeature really as all algorithms would optimize for touching front once anyway.

Input range should “produce” elements not keep cache of them, forward ranges may cache current item alright.


[...]

Reply via email to