Range of uncopyable elements

Jerry via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Dec 8 08:35:02 PST 2016


The problem is with how isInputRange is defined, requires that 
front be copyable.

auto h = r.front; // can get the front of the range

https://github.com/dlang/phobos/blob/v2.072.1/std/range/primitives.d#L168

It doesn't take into consideration that front exists and that 
it's a reference to a struct that can't be copied. There was a 
discussion a while back to change it but it seems nothing came of 
it.


More information about the Digitalmars-d-learn mailing list