[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gzz] 15th, 16th (jvk)
From: |
Janne Kujala |
Subject: |
Re: [Gzz] 15th, 16th (jvk) |
Date: |
Mon, 19 Aug 2002 15:43:44 +0300 |
User-agent: |
Mutt/1.2.5i |
On Mon, Aug 19, 2002 at 02:34:29PM +0300, Antti-Juhani Kaijanaho wrote:
> On 20020819T132426+0300, Janne Kujala wrote:
> > I decided to not use an iterator for getVarNames, because
> > - an array can be sorted inside the Debug library
> > if the internals are changed (e.g., to use a hash)
>
> I don't understand. Iterators are an internals-neutral interface.
True, but only on source level. Most of the time internal changes
would require recompile of all user code.
And what is more, iterators explicitly expose the internal ordering.
> (If you need to have a sorted container, then a balanced tree is a
> better choice than a hash table.)
A hash table could be faster to access and I do want to have
that option later. The speed of getting all variable names is not
important; it is more useful to be able to get the names in
sorted order.
> > - an iterator interface would require lots of extra code
> > (unless the internals are directly exposed)
>
> Most of the time you can just export the iterator of the underlying
> container (this does not mean exposing the internals directly).
In this case
- most of the implementation (the <map> header file) of the
underlying container would also need to be included in
the interface
- the map iterator iterates pairs, not the first elements
of the pairs, which is required
- it is too much work to code a custom iterator hiding
the above details
jvk