opIndex negative index?
cerjones
who at what.com
Thu Jan 21 14:00:28 UTC 2021
I have an iterator that steps along a 2D vector path command by
command and uses opIndex to give access to the points for the
current command. The issue is that there's a shared point between
commands, so when the iterator is on a given command, it also
needs to also allow access to the end point of the previous
command. Currently the iterator juggles the indexes so that for a
cubic you use 0,1,2,3, and 0 gives the previous end point. But it
would simplify a few things if [-1] was for accessing the
previous end point, so a cubic would allow indexes -1,0,1,2.
I'm a bit unsure if this is reasonable or not.
Thoughts?
More information about the Digitalmars-d-learn
mailing list