On 5/16/16 4:39 PM, Alex wrote:
     // something that does not worked as expected:
     // how to rewrite a for loop
     for(auto i = 0; i < b.length; i++) writeln(&b[i]);
     // into a foreach loop?


What you need is a range that produces void * instead element itself.

This would probably work:

struct VoidRange
{
   void[] arr;
   auto front() { return arr.ptr; }
   void popFront() { arr.popFront; }
   bool empty() { return arr.empty; }
}

foreach(p; VoidRange(b)) writeln(p);

-Steve

Reply via email to