opApply and that int

Bill Baxter dnewsgroup at billbaxter.com
Fri Jan 4 18:52:51 PST 2008


A slightly more streamlined version of the demo.

* The Apply_call method was unnecessary baggage. yield() can just call 
dg._loop_body directly

* Resetting *_ret to 0 on every iteration was unnecessary.

* Allowing for _ret to be a null pointer was unnecessary.  That was just 
intended to make it easier for users to call opApply directly.  But 
realistically, there's no reason for users to ever do that.  But if they 
really really want to they still can; they just have to supply that int 
pointer.

(Note: This code is free for anyone to use for whatever purpose they like)


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: newforeach.d
Url: http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20080105/1f316f1e/attachment.txt 


More information about the Digitalmars-d-learn mailing list