refRange with non copyable struct

Stanislav Blinov via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Apr 17 12:39:25 PDT 2017


On Monday, 17 April 2017 at 19:00:44 UTC, Jonathan M Davis wrote:

> Because otherwise, it's not acting like a reference to the 
> original range, which is the whole point of RefRange. The 
> correct solution would probably be to @disable opAssign in the 
> case where the original range can't be overwritten by another 
> range.

This doesn't look quite right. References in D are rebindable. 
That is, assigning a reference to a reference does not copy 
referenced object, only the reference itself.
It seems that RefRange is trying to impersonate a C++ reference.


More information about the Digitalmars-d-learn mailing list