cannot access frame of function

Alex sascha.orlov at gmail.com
Mon Sep 18 14:45:25 UTC 2017


Hi all,
given this code:

import std.algorithm.iteration : sum, cumulativeFold;

void main()
{
	double[5] a;
	a = 0;
	foreach(el; a) assert(el == 0);
	a[0] = 1.0;
	a[1] = 2.0;
	a[2] = 3.0;
	a[3] = 4.0;
	a[4] = 5.0;
	foreach(el; a) assert(el != 0);
	auto asum = a[].sum;
	auto jProbs = a[].cumulativeFold!((a, b) => (a + b)/asum);
}

the last line does not compile.

I found
http://forum.dlang.org/post/mailman.4097.1499105927.31550.digitalmars-d-bugs@puremagic.com
and
https://issues.dlang.org/show_bug.cgi?id=11886

What I do not understand, how my example differs from the fixed 
bug?


More information about the Digitalmars-d-learn mailing list