On 2010-07-13 00:38:55 -0400, Andrei Alexandrescu <seewebsiteforem...@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.for...@michelf.com
http://michelf.com/

Reply via email to