called copy constructor in foreach with ref on Range

Paul Backus snarwin at gmail.com
Tue Jun 23 14:18:08 UTC 2020


On Tuesday, 23 June 2020 at 03:52:23 UTC, Jonathan M Davis wrote:
>
> It is extremely common to wrap ranges in other ranges (and in 
> fact, you basically have to in order to have lazy ranges). That 
> really doesn't work very well - if at all - if you can't copy 
> the range. It might be possible with a bunch of explicit calls 
> to move, but that would result in range-based code in general 
> being @system without a clean way to use @trusted

`move` isn't @system. Perhaps you are thinking of `moveEmplace`?




More information about the Digitalmars-d-learn mailing list