"Andrei Alexandrescu" wrote in message news:[email protected]...

The most difficult pattern that comes to mind is the "long arrow" operator seen in backward iteration:

void fun(int[] a)
{
     for (auto i = a.length; i --> 0; )
     {
         // use i
     }
}

Over the years most of my unsigned-related bugs have been from screwing up various loop conditions. Thankfully D solves this perfectly with:

void fun(int[] a)
{
   foreach_reverse(i, 0...a.length)
   {
   }
}

So I never have to write those again.

Reply via email to