getNext

Michel Fortin michel.fortin at michelf.com
Tue Jul 13 05:54:07 PDT 2010


On 2010-07-13 00:38:55 -0400, Andrei Alexandrescu 
<SeeWebsiteForEmail at erdani.org> said:

> Yah, truth be told getNext won't win a prize for brevity. You need to 
> define both a variable and a pointer to use it:
> 
> T meh;
> T * neh;
> while ((neh = getNext(r, meh))) {
>     ... process *neh ...
> }

At this point what you want is to use a foreach loop. In fact, if 
foreach could be made to work with getNext (and it should), you'd 
rarely need to write that boilerplate code yourself.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list