CppCon 2014: Howard Hinnant 'Types Don't Know #'

preview_player
Показать описание

--
This presentation will be based on the following paper which will be a proposal to the C++ standards committee:

This paper proposes a new hashing infrastructure that completely decouples hashing algorithms from individual types that need to be hashed. This decoupling divides the hashing computation among 3 different programmers who need not coordinate with each other:

1. Authors of hashable types (keys of type K) write their hashing support just once, using no specific hashing algorithm. This code resembles (and is approximately the same amount of work as) operator== and swap for a type.

2. Authors of hashing algorithms write a functor (e.g. H) that operates on a contiguous chunk of generic memory, represented by a void const* and a number of bytes. This code has no concept of a specific key type, only of bytes to be hashed.

3. Clients who want to hash keys of type K using hashing algorithm H will form a functor of type std::uhash to give to an unordered container.

unordered_set my_set;

--
--

*-----*
*-----*
Рекомендации по теме
Комментарии
Автор

You really have to love listening to some people talking and this man is one of them. Interesting issue, simple and beautiful solution.

rturrado
Автор

Is recursive hashing of entire object trees a common need?

StackedCrooked