From: Stefan S. <sie...@st...> - 2007-05-16 09:22:05
|
> >The description "Is there no valid position to right of internal cursor?" > >made > >me think that 'after' is true whenever the cursor is on the _last_ item of > >the linear (and not beyond). I assumed that "no valid position to the > >right" > >means that the next position will not point to an item of the container > >anymore. > > That assumption is incorrect. The internal cursor has a valid position > after the last item - the after-life sentinel (my (joke) terminiology). > > The point is that when you are on the last item, it is still valid to call > `forth'. This will move the cursor forward (hence it's name), and the > cursor has to go somewhere. It goes to the after-sentinel position. Now > there is no longer a valid position, so you may no longer call `forth'. Sorry for not being precise enough. Now I know that there's a valid position after the last item. But I was not aware of this when I read the Description of 'after'. To be honest, I was only interested in the items (to iterate through them), so I guess this is the reason why I didn't think of the sentinels before and after the items. The description is 100% correct, I just interpreted it in a wrong way. Thus I assumed that there will be possibly other people who will get it wrong, too. Therefore I thought, it could be worth to think about the description. |