Andre Poenitz wrote: > On Sat, Aug 18, 2007 at 12:54:56PM +0200, Alfredo Braunstein wrote: >> Abdelrazak Younes wrote: >> >> > Alfredo Braunstein wrote: >> >> This the same concept as the previous post for CursorSlices. >> > >> > I personally agree with the two patches. >> >> Thanks! I'll apply on monday if there are no objections. >> >> btw, we should implement good const semantics for CursorSlice, >> DocIterator and Cursor, it's really missing. > > Do we really need it? It probably means some code duplication, and so
Mmmm, I don't think it implies much code duplication, probably a few well-placed casts would suffice. But I'd have to try ;-) Note that the fake constness of DocIterator spans around 80 lines of duplicated code in current trunk. > far the old 'fake' constness you just remove sort-of-worked. There are at least two problems with the fake constness IMO: - you can inadvertently bypass it (like when you 'fake-cast' to non-const in the example CursorSlice b = a;). With no cast at all. - it f** up goot const semantics for the iterators themselves: now you cannot send a pair of DocIterator const & to a method that has just to change a font: the method has to copy (!) the DocIterators to access the data. A/