On Tuesday, 12 July 2022 at 14:55:47 UTC, anonymouse wrote:
I've tried using a foreach loop to achieve this but failed miserably.--anonymouse
Wait, I think I've got it. This little snippet does the trick: int index; foreach(i, v; a) { int t = v; foreach(d; dims[i+1 .. a.length]) tmp *= d; index += tmp; } Thanks, everyone. --anonymouse