On Thu, Oct 09, 2003 at 11:27:10AM +0200, Lars Gullik Bjønnes wrote: > Andre Poenitz <[EMAIL PROTECTED]> writes: > > | On Thu, Oct 09, 2003 at 11:14:04AM +0200, Lars Gullik Bjønnes wrote: > >> What type does std::distance return? We should use that for the > >> offsets. > > > | Some difference_type. > > > | I currently use > | > | typedef std::vector<char>::difference_type par_type; > > > | which is not _exactly_ what we need, but I've not seen any compiler > | implementation which is using different difference_type's for different > | containers. > > Would it cost a lot to use the right one?
Depends where we define it. If it stays in support/types.h we'd pull in std::list<Paragraph> in BufferView_pimpl.h:#include "support/types.h" CutAndPaste.h:#include "support/types.h" InsetList.h:#include "support/types.h" ParagraphParameters.h:#include "support/types.h" ParameterStruct.h:#include "support/types.h" buffer.h:#include "support/types.h" bufferparams.h:#include "support/types.h" changes.h:#include "support/types.h" cursor.h:#include "support/types.h" lyxcursor.h:#include "support/types.h" lyxfind.h:#include "support/types.h" lyxrow.h:#include "support/types.h" lyxrow_funcs.h:#include "support/types.h" lyxtextclasslist.h:#include "support/types.h" paragraph.h:#include "support/types.h" paragraph_funcs.h:#include "support/types.h" sgml.h:#include "support/types.h" text_funcs.h:#include "support/types.h" which basically is 'everywhere'. Hmm... Ok. Clean solution: The list::difference_type is typedef typename Allocator::difference_type difference_type; The Allocator::difference_type is ptrdiff_t from <cstddef> So we'd jsut use a typedef of ptrdiff_t from cstddef. Happy? > and par_type is a bit anonymous... offset_type, offset_t ? 'par_offset_type' perhaps? Andre'