given some array, is there some way to easily impose structure on that array at runtime?

void* data;

auto x = cast(byte[A,B,C])data;

X is then an AxBxC matrix.

I'm having to compute the index myself and it just seems unnecessary. A and B are not known at compile time though.

Obviously it should be just as efficient as computing the offset manually.

I could probably do this with a struct and override opIndex but I'm wondering what is already out there. If it's slower or consumes more memory than manual it's not worth it(since my code already calcs the index).



Reply via email to