isInputRange is false for non-copyable types

Dmitry Olshansky dmitry.olsh at gmail.com
Sun Apr 15 10:14:20 UTC 2018


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.

>
> [...]



More information about the Digitalmars-d mailing list