How is chunkBy supposed to behave on copy

Paul Backus snarwin at gmail.com
Sun Mar 22 16:23:27 UTC 2020


On Sunday, 22 March 2020 at 15:43:45 UTC, H. S. Teoh wrote:
> On Fri, Mar 20, 2020 at 05:50:26PM -0600, Jonathan M Davis via 
> Digitalmars-d wrote: [...]
>> And exactly what should happen with basic input ranges is not 
>> clear, because while ideally, you'd just require that they 
>> have full-on reference semantics, that tends to mean that 
>> you're forcing them to be allocated on the heap, which isn't 
>> really the sort of thing that we want to force if we can avoid 
>> it.
> [...]
>
> You could just have input ranges be a struct with the copy ctor 
> @disable'd, perhaps?
>
>
> T

Technically, this is already legal--isInputRange accepts 
non-copyable structs.

Of course, if you accept non-copyable ranges as legitimate, 
someone has to go and fix all of std.algorithm and std.range to 
handle them correctly, which is a non-trivial amount of work.


More information about the Digitalmars-d mailing list