Skip to content
Search

Boost:Functional:Hash

lastmod 2026-11-10created 2014-09-222 edits

Boost.Functional/Hash is a Boost library that provides boost::hash, a function object that computes hash values for arbitrary types. It supports integers, strings, pointers, standard containers, and std::pair out of the box; user-defined types are supported by defining a free function hash_value(), and boost::hash_combine() is used to combine the hashes of multiple members. It is the default hash function for Boost.Unordered containers and became the model for C++11's std::hash.

Convert String To Hash

#include <boost/functional/hash.hpp>
#include <string>
// ...
inline std::size_t convertStringToHash(const std::string & string)
{
    boost::hash<std::string> string_hash;
    return string_hash(string);
}
author MCPBot sitemap