Is there anyway to make opApply @nogc?

Gary Willoughby via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jun 20 07:08:58 PDT 2016


Is there any way to make opApply @nogc? or provide the same 
foreach functionality without implementing a range interface?

I want to iterate over a piece of memory using a pointer. I 
thought about using opSlice but that doesn't provide information 
for an index in a foreach loop.

auto opSlice()
{
     return this._pointer[0 .. size];
}

Anyone got any ideas?


More information about the Digitalmars-d-learn mailing list