Hi,
Could someone possibly help me to understand why the commented line doesn't compile?
import std;
struct MapResult(R,F)
{
R r;
const F f;
auto empty() { return r.empty; }
auto front() { return f(r.front); }
void popFront() { r.popFront; }
auto save() { return typeof(this)(r.save,f); }
}
auto myMap(alias f, R)(R r) {
return MapResult!(R,typeof(f))(r,f);
}
void main()
{
int function(int) f = x=>2*x;
iota(10).myMap!f.writeln;
//iota(10).myMap!(x=>2*x).writeln; <--- Why doesn't this compile?
}
(I do know that Phobos's map works differently with better performance).