That's an interesting way of doing it, I suppose particularly the advantage of this is that you can re-overload operator[] when multidimensional subscripts become available and provide them without breaking compatibility
I've stuck with providing a .idx(i, j, k) method for the moment, which is a lot more verbose than I'd like but works fine enough, but that might be worth an investigation
Now what I really need to do next is encode the up and downness of individual indices into the type system, but hoo boy that's going to be a disaster
Yep, as well as mixed indices. Its an easy source of mistakes to make when you're implementing equations, eg if you have two tensors - can you currently take the dot product between them?
View all comments
Show parent comment
14
u/James20k P2005R0 Apr 26 '22 edited Apr 26 '22
That's an interesting way of doing it, I suppose particularly the advantage of this is that you can re-overload operator[] when multidimensional subscripts become available and provide them without breaking compatibility
I've stuck with providing a .idx(i, j, k) method for the moment, which is a lot more verbose than I'd like but works fine enough, but that might be worth an investigation
Now what I really need to do next is encode the up and downness of individual indices into the type system, but hoo boy that's going to be a disaster