On Thu, May 24, 2012 at 11:43 AM, Lawrence Crowl <cr...@google.com> wrote: > Add a type-safe hash table, typed_htab. Uses of this table replace > uses of libiberty's htab_t. The benefits include less boiler-plate > code, full type safety, and improved performance.
Lawrence, is there any chance you could just call it hash_table<>? After the conversion, we will be living most of the time in a typed world, so the "typed_" prefix will be redundant if not confusing :-) [...] > The type-safe hash table is a template, taking the element type > and the operational functions as template parameters. Passing the > operational functions as template parameters, rather than function > pointers, exposes the calls to inlining at -O2. A side effect is that > declarations of hash tables move to after the declarations of those > functions. A further side effect is that the control block shrinks > from 108 bytes to 44 bytes. There is otherwise no effect on data > size. Nice. Do you anticipate that at some point we could just pass function object classes as template arguments as opposed to functions? That of course would retain the nice property of inlining, but it would remove the need to make the function have an external linkage. The downside is that change would touch more places than your current patch does. -- Gaby