Let's pretend i have this code:
Stuff[] mystuff;
foreach (item; mystuff)
{
}
How do i get a pointer?
I can get a reference if i prefix item
with ref
, but i need a pointer specifically, it can't be impossible, can it?
I could do:
foreach (i, item; mystuff)
{
auto ptr = &mystuff[i]
}
But this is slow, now does bound checking twice..
I can also fall back to using a C loop, but i'd rather use D for loop
If not possible, why? and what does it take to add support for it in the compiler?