N3786: Convenience Functions to Combine Hash Values -- Nicolai Josuttis

A new WG21 paper is available. A copy is linked below, and the paper will also appear in the next normal WG21 mailing. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N3876

Date: 2014-01-19

Convenience Functions to Combine Hash Values

by Nicolai Josuttis

Excerpt:

Currently, there is not support in C++ to define hash functions for user-defined keys. Instead, the user has to implement an appropriate function. Implementing a hash function is not trivial. This proposal has the goal to make the definition of hash functions for user-defined types easier by providing a convenience function to combine multiple hash values.

The goal is not to provide a perfect hash function here, but to provide an easy-to-use interface to help application programmers to provide an pretty useful hash function so that they can use hash containers with their types. Note that this does not disable the ability to still provide better user-defined hash tables. It just helps to avoid that a user-defined hash function is better than a naive approach.

Note also that this paper doesn’t provide an easier approach to define new hash functions (as discussed in N333).

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.