[fpc-devel] Generic Programming Units
Marco van de Voort
marcov at stack.nl
Tue Jun 21 22:35:08 CEST 2005
> > Depends how the hash is parametrized. If you've a big hash array and a
> > good hash function accessing has a complexity of O(1) while for a binary
> > search it's O(log(n))
> But I assume that calculating the hash becomes harder for 'better' hashes ?
Only for general purpose hashes. Specific hashes are easier. This is where
templates/generics come into play.
You can then instantiate an hash container with a custom hashing code
_specific for your current application_ while avoiding any overhead, (and
remaining typesafe, but that is not relevant to this discussion)
More information about the fpc-devel