bsl::hash

Empty base class for hashing. This class, and all explicit and partial specializations of this class, shall conform to the C++11 Hash Requirements (C++11 17.6.3.4, [hash.requirements]). Unless this template is explicitly specialized, it will use the default hash algorithm provided by bslh::Hash<> to supply hash values. In order to hash a user-defined type using bsl::hash, bsl::hash must be explicitly specialized for the type, or, preferably, hashAppend must be implemented for the type. For more details on hashAppend and bslh::Hash see the component bslh_hash.

Synopsis

Declared in <bslstl_hash.h>

template<class TYPE>
struct hash
    : BloombergLP::bslh::Hash<>

Base Classes

NameDescription
BloombergLP::bslh::Hash<>This struct wraps the (template parameter) type HASH_ALGORITHM in an interface that satisfies the hash requirements of the C++11 standard.

Type Aliases

NameDescription
HashAlgorithm Make the HASH_ALGORITHM template parameter available to clients.
result_type The type of the hash value that will be returned by the function-call operator.

Member Functions

NameDescription
operator() Function call operators

Specializations

NameDescription
hash<bool> Specialization of hash for bool values.
hash<char> Specialization of hash for char values.
hash<std::thread::id>
hash<int> Specialization of hash for int values.
hash<long> Specialization of hash for long values.
hash<long long> Specialization of hash for long long values.
hash<short> Specialization of hash for short values.
hash<signed char> Specialization of hash for signed char values.
hash<unsigned char> Specialization of hash for unsigned char values.
hash<unsigned int> Specialization of hash for unsigned int values.
hash<unsigned long> Specialization of hash for unsigned long values.
hash<unsigned long long> Specialization of hash for unsigned long long values.
hash<unsigned short> Specialization of hash for unsigned short values.
hash<wchar_t> Specialization of hash for wchar_t values.
hash<BSLSTL_KEY const> This class provides hashing functionality for constant key types, by delegating to the same function for non-constant key types.
hash<basic_string<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>> Specialize bsl::hash for strings, including an overload for pointers to allow character arrays to be hashed without converting them first.

Derived Classes

NameDescription
hash<BSLSTL_KEY const> This class provides hashing functionality for constant key types, by delegating to the same function for non-constant key types.