Foreach, return not exist the function.
Zaher Dirkey via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jan 11 23:47:52 PST 2015
On Sunday, 11 January 2015 at 23:50:18 UTC, Ali Çehreli wrote:
> On 01/11/2015 12:25 PM, Zaher Dirkey wrote:
>
> > reproduce example here
> > http://dpaste.dzfl.pl/13fb453d0b1e
>
> That link doesn't work for me. (?)
>
> Does opApply return the delegate's return value ('b' below)?
>
It must return object, but it is in template
i added ref, or witout ref, same
this the part of opApply
int opApply(int delegate(ref T) callback)
{
int result = 0;
for (int i = 0; i < _items.length; ++i)
{
result = callback(_items[i]);
if (result == 0)
break;
}
return result;
}
this part code here
https://github.com/parmaja/sard/blob/master/src/sard/classes.d
and reproduced (but works fine) here
https://github.com/zaher/d_test/blob/master/foreach.d
More information about the Digitalmars-d
mailing list