I'm trying to write an overload of qHash
where the hash will be computed using a Core Foundation type.
Apple provides the following function for this: CFHashCode CFHash(CFTypeRef cf);
This is all well and good, but qHash
requires a second argument, a seed value. While my code can compile if I implement qHash
without it, the qHash
documentation has the following warning:
Note: In Qt 6 it is possible to define a qHash() overload taking only one argument; support for this is deprecated. Starting with Qt 7, it will be mandatory to use a two-arguments overload.
So rather than relying on deprecated behavior, I'd like to include the seed argument.
The question is, how do I calculate the hash when the third party hashing function I'm reliant on doesn't use a seed?
Is returning something like CFHash(cf) ^ seed
acceptable? Or perhaps a better option is CFHash(cf) ^ qHash(seed, 0)
?