Hello!
Suppose I have:
Values = SVector{3, Int64}[[3, 0, 1], [2, 3, 4], [3, 4, 3], [2, 3, 2], [0, 2, 2], [4, 2, 4], [4, 2, 4], [0, 3, 3], [4, 2, 0], [2, 2, 0], [0, 0, 0], [0, 0, 2], [2, 1, 4], [2, 0, 4], [1, 2, 2], [1, 1, 0], [0, 1, 2], [1, 3, 4], [1, 4, 4], [4, 0, 1]]
Which a Vector of SVectors with a dimension of 3. I can loop over this as such:
for (i,j,k) in Values
# do something
end
Suppose now I have:
Values = SVector{2, Int64}[[3, 0], [2, 3], [3, 4], [2, 3], [0, 2], [4, 2], [4, 2], [0, 3], [4, 2], [2, 2], [0, 0], [0, 0], [2, 1], [2, 0,], [1, 2], [1, 1], [0, 1], [1, 3], [1, 4], [4, 0]]
Now looping with the previous loop, with (i,j,k) will fail. I know I can change it to (i,j). My question is instead;
Is there an elegant way to avoid switching amount of indices by a “manual” decision and instead let code handle it?
Other than “if dim = 2, (i,j) if dim = 3, (i,j,k)”
Kind regards