On Thu, Dec 08, 2016 at 04:35:02PM +0000, Jerry via Digitalmars-d-learn wrote:
> 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.

A possible workaround, which is somewhat ugly but should work, is to
have the range return pointers to the elements instead of the elements
themselves. For the most part, this should be mostly transparent because
the . operator automatically dereferences.


T

-- 
Designer clothes: how to cover less by paying more.

Reply via email to