Lars Gullik Bjønnes wrote: > IMHO it is your comments about the stl that are confusing... and I do > not get your point about it.
What I say is that the value -1 for lastPos() is not 'magic', it perfectly consistent. On a paragraph with n positions, lastPos() should return n-1. So if the paragraph is empty it should return -1. (similar behavior as std::string::rend(), modulo translation on indices to iterators) Or else, shift all by one, and it should returns n. Then on an empty par it returns 0. Right now it returns max(n-1,0). This forces special casing in several points. And this special casing is not even in place always as the asserts testify. Alfredo