This works fine –
import std.stdio : writeln;
import std.range : iota, take;
import std.algorithm : filter, map, each;
void main() {
auto range1 = iota(0, 100)
.filter!(x => x % 2)
.take(50);
range1.each!writeln;
}
This also works fine –
void main() {
auto cls = new Class;
cls.range1.each!writeln;
}
class Class {
auto range1 = iota(0, 100)
.take(50);
}
But this doesn't –
void main() {
auto cls = new Class;
cls.range1.each!writeln;
}
class Class {
auto range1 = iota(0, 100)
.filter!(x => x % 2)
.take(50);
}
Adding the .filter!
messes things up.
Same with .map!
void main() {
auto cls = new Class;
cls.range1.each!writeln;
}
class Class {
auto range1 = iota(0, 100)
.map!(x => x * 2)
.take(50);
}
My question is, why?
I mean, am I just dumb or is this some kinda bug?