Problem with C++ ranges also exhibited by D
Dukc
ajieskola at gmail.com
Tue Apr 16 12:47:51 UTC 2019
On Tuesday, 16 April 2019 at 12:07:03 UTC, Atila Neves wrote:
> This blog post shows off some problems with the ranges v3
> library that is going to be included in the C++20 standard
> library.
I belive the current design is superior, because of the ease of
doing this:
import std.algorithm;
import std.range;
import std.stdio;
void main() {
iota(1, 6)
.map!((n) { writeln("transform ", n); return n * 2; })
.cache
.filter!(n => n % 4 == 0)
.writeln;
}
After all, sometimes you might want front() to be lazy. With the
current design, you have the choice.
More information about the Digitalmars-d
mailing list