Abdelrazak Younes a écrit :
Angus Leeming a écrit :
Ah... This is because I didn't go to the full monty... I forgot to erase those three lines:
-          advance(first, first_pit);
-          ParagraphList::const_iterator last = plist.begin();
-          advance(last, last_pit + 1);

It is better now, isn't it?

I think so, but if last_pit is a ParagraphList::iterator which won't necessarily
model a Random Access Iterator in the future, you should probably use
    undo.pars = ParagraphList(plist, first_pit, boost::next(last_pit));

In this case, first_pit and last_pit are positions in the ParagraphList plist. But I can also provide a ParagraphList constructor that will accept iterators "a la STL".

By the way, right now, there are multiple instances in the code where operator[] access is used. Thus implying that we must present a position type interface (vector alike). At the same time, like in the case above, there are instances where the coder preferred an iterator interface. I am fine with the idea of presenting both types of interfaces (my version of ParagraphList presents both) but what is the opinion of developers? Do we have to force one way or the other? My opinion is that for cases like the above, a position type interface is better because shorter. But there are other cases where an iterator interface should be very useful... albeit not many in current cvs (or svn :-)). But sometimes too much choice kills the flexibility...

Abdel.

Reply via email to