typeof map
H. S. Teoh
hsteoh at quickfur.ath.cx
Mon Jun 24 22:35:28 PDT 2013
On Tue, Jun 25, 2013 at 04:45:33AM +0200, cal wrote:
> Is it by design that the code below does not compile?
>
> import std.algorithm, std.range;
>
> void main() {
> typeof(iota(10).map!(a=>a)) x = iota(10).map!(a=>a);
> }
[...]
The workaround is to use 'auto', then alias its type:
auto x = iota(10).map!(a=>a);
alias IotaType = typeof(x);
But yeah it would be nice if the original code worked.
T
--
Tell me and I forget. Teach me and I remember. Involve me and I understand. -- Benjamin Franklin
More information about the Digitalmars-d-learn
mailing list