On Friday, 18 September 2015 at 11:54:32 UTC, Robert burner Schadek wrote:
http://dlang.org/phobos/std_exception.html#.handle

foreach(file; dirEntries(args[1], SpanMode.depth)
.handle!(Exception, RangePrimitive.front, (e, r) => DirEntry())) {
    writeln(file.name);
}

change Exception to the Exception Type to handle and select the throwing range primitive (RangePrimitive). Then just supply a delegate that does the actual handling.
This will not break any range chain!

Cool, I wish I had this idea back in 2012.

Reply via email to