pub unsafe fn q_hash_bits_void_ulong_uint(
    p: *const c_void,
    size: c_ulong,
    seed: c_uint
) -> c_uint
Expand description

Returns the hash value for the memory block of size len pointed to by p, using seed to seed the calculation.

Calls C++ function: unsigned int qHashBits(const void* p, unsigned long size, unsigned int seed = …).

C++ documentation:

Returns the hash value for the memory block of size len pointed to by p, using seed to seed the calculation.

Use this function only to implement qHash() for your own custom types. For example, here's how you could implement a qHash() overload for std::vector<int>:

inline uint qHash(const std::vector<int> &key, uint seed = 0) { if (key.empty()) return seed; else return qHashBits(&key.front(), key.size() * sizeof(int), seed); }

This takes advantage of the fact that std::vector lays out its data contiguously. If that is not the case, or the contained type has padding, you should use qHashRange() instead.

It bears repeating that the implementation of qHashBits() - like the qHash() overloads offered by Qt - may change at any time. You must not rely on the fact that qHashBits() will give the same results (for the same inputs) across different Qt versions.

This function was introduced in Qt 5.4.

See also qHashRange() and qHashRangeCommutative().