opApply compilation woes

2015-07-12 Thread Gary Willoughby via Digitalmars-d-learn
Why does the following code fail to compile if the `writeln(value);` line is present? public template ForeachAggregate(T) { alias ForeachAggregate = int delegate(ref T) nothrow; } unittest { import std.stdio; class Foo { private string[] _data =

Re: opApply compilation woes

2015-07-12 Thread anonymous via Digitalmars-d-learn
On Sunday, 12 July 2015 at 17:25:17 UTC, Gary Willoughby wrote: Why does the following code fail to compile if the `writeln(value);` line is present? The error message (formatted to be a little more readable): Error: function test2.__unittestL6_1.Foo.opApply (int delegate(ref string)

Re: opApply compilation woes

2015-07-12 Thread Gary Willoughby via Digitalmars-d-learn
On Sunday, 12 July 2015 at 17:33:50 UTC, anonymous wrote: On Sunday, 12 July 2015 at 17:25:17 UTC, Gary Willoughby wrote: Why does the following code fail to compile if the `writeln(value);` line is present? The error message (formatted to be a little more readable): Error: function