How is chunkBy supposed to behave on copy

Ben Jones fake at fake.fake
Fri Mar 20 22:15:18 UTC 2020


On Friday, 20 March 2020 at 22:11:49 UTC, H. S. Teoh wrote:
> On Fri, Mar 20, 2020 at 03:59:57PM -0600, Jonathan M Davis via 
> Digitalmars-d wrote:
>> [...]
> [...]
>> [...]
>
> Yes, that's right.  Actually, for by-value ranges the act of 
> passing them as an argument to a range function in the first 
> place already copies them.  The catch is really that once this 
> happens, the caller or whoever retains the original copy should 
> no longer assume that the range remains in the same place as 
> before.  For some ranges this is true, but for other ranges 
> this assumption is invalid, and will lead to incorrect results.
>
>
>> [...]
> [...]
>
> +1.
>
>
> T

So range "copy" is really what a C++ person would call range 
"move" ?  It might be a copy, or it might invalidate the 
original, depending on the type?


More information about the Digitalmars-d mailing list