Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is an old version of boost. Click here for the latest version's documentation home page.
PrevUpHomeNext

Function template hash_combine

boost::hash_combine — Called repeatedly to incrementally create a hash value from several variables.

Synopsis

template<typename T> void hash_combine(size_t & seed, T const & v);

Description

Effects:

seed ^= hash_value(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);

Notes: hash_value is called without qualification, so that overloads can be found via ADL.

This is an extension to TR1


Throws: Only throws if hash_value(T) throws. Strong exception safety, as long as hash_value(T) also has strong exception safety.

Copyright 2005 Daniel James

PrevUpHomeNext