Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Chapter 15. Boost.Functional/Hash

Daniel James

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Table of Contents

Introduction
Tutorial
Extending boost::hash for a custom data type
Combining hash values
Portability
Disabling The Extensions
Change Log
Rationale
Reference
Header <boost/functional/hash.hpp>
Links
Acknowledgements

boost::hash is an implementation of the hash function object specified by the Draft Technical Report on C++ Library Extensions (TR1). It is the default hash function for Boost.Unordered, Boost.Intrusive's unordered associative containers, and Boost.MultiIndex's hash indicies and Boost.Bimap's unordered_set_of.

As it is compliant with TR1, it will work with:

  • integers
  • floats
  • pointers
  • strings

It also implements the extension proposed by Peter Dimov in issue 6.18 of the Library Extension Technical Report Issues List (page 63), this adds support for:

  • arrays
  • std::pair
  • the standard containers.
  • extending boost::hash for custom types.
[Note] Note

This hash function is designed to be used in containers based on the STL and is not suitable as a general purpose hash function. For more details see the rationale.

Last revised: December 14, 2017 at 00:08:10 GMT


PrevUpHomeNext