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



> > 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...)

Some Guy <guy@mikepery.pr.mcs.net> writes:
> Ewwww no, I hate iterators :). I don't really understand the point of
> them; they just use fancy operators to traverse through lists. What's the
> difference between doing
>     lptr = lptr->next;
> and
>     ++liter;

There isnt. Except standardization. And standards make the code easier
to understand, compatible with other code made with C++ etc. Standards
are a good thing.

> ? Of course I'm probably missing some advantage to them, but even so, they
> are just a fancy way of saying 'I spent a lot of time coding my linked
> list', when the same thing could be accomplished without them.

The beauty of iterators is that gtk-- does not need to rely on any way
of the STL and still all STL's algorithms work with Gtk_Container. The
main thing is to be consistent on what operations have been
implemented.  Thus you have a choice of using STL's algorithms or not.

This is not true with any C libraries, as they all implement their own
conventions of how to access data inside containers.

(If a standard is not good for you, you do not go inventing your own
and deny your users ability to interact with all the other C++ code in
the universe - do you? (well, you do, if you're microsoft and only care
about selling more copies of whatever you're selling..))

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



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