While there is a possible solution for this (as the author describes in the previous comment), this is something you should not really consider a useful pattern in your application. Prefer a struct of arrays instead. This makes the code way cleaner results in better cache utilization.