Re: input range with non copyable element

2021-08-09 Thread vit via Digitalmars-d-learn
On Monday, 9 August 2021 at 02:47:40 UTC, Mathias LANG wrote: On Sunday, 8 August 2021 at 18:36:02 UTC, vit wrote: Hello, is there reason why elements of input range must be copyable? By design, not that I can think of. But it is assumed all over the place, unfortunately. You can make your

Re: input range with non copyable element

2021-08-08 Thread Mathias LANG via Digitalmars-d-learn
On Sunday, 8 August 2021 at 18:36:02 UTC, vit wrote: Hello, is there reason why elements of input range must be copyable? By design, not that I can think of. But it is assumed all over the place, unfortunately. You can make your `front` method return by `ref`, but you're still going to get

input range with non copyable element

2021-08-08 Thread vit via Digitalmars-d-learn
Hello, is there reason why elements of input range must be copyable? For example this example works and copy ctor is never called: ```d import std.algorithm : map; import std.range; struct Foo{ int i; this(scope ref typeof(this) rhs)pure nothrow @safe @nogc{ //this.i =