Re: [gtk-list] Re: Gtk--: G_List quirks



Guillaume Laurent <glaurent@worldnet.fr> writes:
> >    for (list = container->children();
> > 	list->glist() != NULL;
> > 	list = list->next()) ...
> 
> Side note : don't do that. Use iterators :
> 
> 	list = container->children();
> 	for(iter = list->begin(); iter != list->end(); ++iter) { ... }
> 
> - add peek_next() and peek_prev() calls which would simply return the
>   next/prev node without changing the underlying GList
> 
> or
> 
> - rename the current next()/prev() to move_next()/move_prev(), and
>   have next()/prev() return the node like the peek_* calls.
> 
> (new call names are non-contractual :-)
> 
> Tero ?

I would prefer if people used the iterator approach... Its much
better... Though it should be improved to allow also modifying the
list through it. (maybe removing next(), prev() and those would be ok?
:) (though some of those other wrapped functions are useful for people
who dont want to depend on STL's algorithms...)

-- 
-- Tero Pulkkinen -- terop@modeemi.cs.tut.fi --



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