isInputRange is false for non-copyable types
Dmitry Olshansky
dmitry.olsh at gmail.com
Sun Apr 15 10:24:15 UTC 2018
On Sunday, 15 April 2018 at 10:14:20 UTC, Dmitry Olshansky wrote:
> 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.
On a related note this also destroys idea of “lock-free” or
“concurrent” input ranges since front/empty/popFront sequence of
calls can’t be cheaply synchronized in as a whole in presence of
multiple consumers.
>
>>
>> [...]
More information about the Digitalmars-d
mailing list