Questions about _Hash_code_base

Jonathan Wakely jwakely@redhat.com
Thu Dec 5 11:57:29 GMT 2024


The _Hash_code_base class template has a large comment:

  /**
   *  Primary class template _Hash_code_base.
   *
   *  Encapsulates two policy issues that aren't quite orthogonal.
   *   (1) the difference between using a ranged hash function and using
   *       the combination of a hash function and a range-hashing function.
   *       In the former case we don't have such things as hash codes, so
   *       we have a dummy type as placeholder.
   *   (2) Whether or not we cache hash codes.  Caching hash codes is
   *       meaningless if we have a ranged hash function.
   *
   *  We also put the key extraction objects here, for convenience.
   *  Each specialization derives from one or more of the template
   *  parameters to benefit from Ebo. This is important as this type
   *  is inherited in some cases by the _Local_iterator_base type used
   *  to implement local_iterator and const_local_iterator. As with
   *  any iterator type we prefer to make it as small as possible.
   */

I think every line of this is irrelevant now, right?

This is the primary template, but there are no partial specializations
now, so this is the only definition of it. We don't use the former
case of ranged hash functions any more, and this type doesn't cache
hash code. And we don't have key extraction objects here either.

This class template is just a wrapper around the _Hash object, and
some utility functions to use it, right?



More information about the Libstdc++ mailing list