[Issue 5641] Local instantiation does not save context properly
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Feb 22 12:13:18 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5641
Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |andrej.mitrovich at gmail.com
--- Comment #3 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2011-02-22 12:10:35 PST ---
A workaround for those that need this code to work is to use static (it can be
used for type inference just like auto):
import std.stdio;
import std.algorithm;
auto fun(int[] a)
{
static y = 3;
return map!((x) { return x == y; })(a);
}
void main()
{
auto a = [ 1, 2, 3, 4, 5 ];
auto m = fun(a);
writeln(m);
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list