On 07/02/2010 01:37 AM, Bruno Haible wrote:
Hi all,
Apropos hash tables.
For some years now, we have generic lists in gnulib. "Generic" means that the
programmer can switch the implementation easily, because he's programming
against an abstract API that has a number of different implementations.
Here is my draft for applying the same approach to unordered sets. The normal
implementation would be a hash table, but there are important variations:
- Is the key a pointer, or a memory block of arbitrary size?
- Is the value stored, or implicit?
- Does inserting a (key,value) pair make a copy of the key?
- Does the table allow removals?
Feedback is highly appreciated! Do you see some interesting use case that I
have overlooked?
I disagree that all these should be in gnulib. In fact, I think ADTs
don't belong there. libunistring and crypto stuff are borderline
already (because some of the modules actually make sense in gnulib, e.g.
uniwidth and sha1), but these should be in a shared library, not a
static one.
In fact, glib or libnih probably provide all that you need already, and
they're always loaded on a modern Linux system so their cost is
effectively zero. (Then, getting stuff into glib is a royal pain in the
ass).
Paolo