On 08/16/2016 11:34 PM, ag0aep6g wrote:
As for the example, you can rewrite it like so:
----
auto failhard(T)(T iter) {
import std.stdio;
import std.range: take, drop, refRange;
writeln("We have some range:");
writeln(typeid(T));
writeln("We take 1 from it...");
writeln(refRange(&iter).take(1));
writeln("The rest of the range has:");
writeln(iter);
writeln("");
}
----
Also need to add @property to `front` and `empty` in the ranges.
refRange is picky about this.
My apologies, that actually prints "[0, 1, 2, 3]" in the array case. I
don't what's going on. That should work. Maybe I'm misunderstanding
something about refRange.