having problem with `std.algorithm.each`

ref2401 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Nov 30 01:54:51 PST 2015


It seems like `std.algorithm.each` is not executed in the example 
below.
Could anyone tell why?
Thank you.


import std.algorithm;

void main(string[] args) {
	int[] arr = [1, 2, 3, 4, 5];

	arr.each!((ref e) => {
		writeln(e); // does not print
		++e;
	})();

	writeln(arr); // prints [1, 2, 3, 4, 5]
}


More information about the Digitalmars-d-learn mailing list