getNext

Shin Fujishiro rsinfu at gmail.com
Tue Jul 13 09:47:29 PDT 2010


Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
> There's the classic problem of reusing the same temporary. Consider:
> 
> Range r1, r2;
> ElementType!Range * p1, p2;
> while ((p1 = getNext(r1)) && (p2 = getNext(r2)))
> {
>     ... oops ...
> }
> 
> You need one temporary for each static occurrence of getNext.

To my shame, I missed it!

Anyways, I like getNext().  LockingTextReader definitely needs it.


Shin


More information about the Digitalmars-d mailing list