Re: [gtkmm] Do the TextBuffer operations really modify the iterators?



On Wed, 2002-08-07 at 03:47, Murray Cumming wrote:
> On Tue, 2002-08-06 at 22:00, ERDI Gergo wrote:
> > Lots of TextBuffer operations have signatures like this:
> > 
> >   void delete_text(iterator& start, iterator& end);
> > 
> > Do these really return something in start/end? It's very inconvenient that
> > I can't just write
> >     buffer->delete_text (buffer->begin (), buffer->end ());
> 
> > If the signature was
> > 
> >   void delete_text (const iterator &begin, const iterator &end);
> > 
> > it would work. So the real question is -- is this all deliberate (i.e.
> > is begin/end modified to some meaningful value when the methods return)
> > or just a typo?
> 
> >From the gtk_text_buffer_delete() docs:
> http://developer.gnome.org/doc/API/2.0/gtk/gtktextbuffer.html#gtk-text-buffer-delete
> "
> the @start and @end will be re-initialized to point to the location
> where text was deleted.
> "
> 
> But, feel free to add an overload with const parameters, it would just
> copy the iterators before giving them to GTK+.

If you're gonna do that, then make it return the iterator where the
deletion occurred.  That would be more STL-like.

iterator delete_text(const_iterator& begin, const iterator& end);


Regards,
Carl




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]