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 the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Struct template hash

boost::hash — A TR1 compliant hash function object.

Synopsis

// In header: <boost/container_hash/hash.hpp>

template<typename T> 
struct hash : public std::unary_function<T, std::size_t> {
  std::size_t operator()(T const&) const;
};

Description

std::size_t operator()(T const& val) const;

Returns:

hash_value(val)

Notes:

The call to hash_value is unqualified, so that custom overloads can be found via argument dependent lookup.

This is not defined when the macro BOOST_HASH_NO_EXTENSIONS is defined. The specializations are still defined, so only the specializations required by TR1 are defined.

Forward declared in <boost/container_hash/hash_fwd.hpp>

This hash function is not intended for general use, and isn't guaranteed to be equal during separate runs of a program - so please don't use it for any persistent storage or communication.

Throws:

Only throws if hash_value(T) throws.


PrevUpHomeNext