On 13.07.2010 06:38, Andrei Alexandrescu wrote: > 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 ... > } >
One way to make this slightly easier would be allowing auto in loop bodies, same as it works in if - ie. T meh; while (auto neh = getNext(r, meh)) { }