Angus Leeming a écrit :
Abdelrazak Younes <[EMAIL PROTECTED]> writes:
>>
difference_type operator-(iterator it1, iterator it2) const {
                        return std::distance(it1, it2);
                }

(Non-member functions can't be const :))

:)

Actually, I don't think that this is really a criticism of your code (operator-)
but rather of the existing LyX sources that assume the use of a Random Access
Iterator. If we really want our code to be container-agnostic then we should be
using std::distance directly. operator- implies that the iterators are Random
Access iterators with O(1) behaviour.

Agreed. And my original patch fixed all those but these changes scared Lars.

 > (You have the vector, and can thus get O(1) operator+, but not if you
use the list::iterator.)
IMHO, you want the butter and the money of the butter.

Is that the same as "On ne peut pas manger l'omelette sans casse' les oeufs"?
("You can't have your cake and eat it" in English.)

Not exactly, it's more like "you cannot solve two opposite problems with a single solution" or something like that. Do you have a better explanation Jean-Marc?

Copy is the wrong name for this. In the other containers this is
called 'assign'.
'copy' means more to me that 'assign' but OK.

If you're making an STL-like container, use STL terminology...

OK

I also think that it_vector really should be a RandomAccessList, tuned
for only working with std::list as the main container and std::vector
as its 'iterator cache'
I need more explanation. For me, if you restrain the use to operator[] and operator() access ParagraphList would be plenty fast. I would really like to keep compatibility with the inner container (in this case std::list).

I think that Lars is going too far too fast. (Funnt, since he insisted that you
break your original patch down into smaller chunks of which this is the first.)

This was my impression too but hey, I won't complain that I caught its interest!

If profiling tells us that we need O(1) operator[] access to the underlying
std:list container, then so be it. First, however, I think that we should try
out your class as it is now.

Yes, please try it.

Abdel.

Reply via email to