Is it possible to use QPoint as a QHash key type?
According to documentation it's possible. But you need define:
inline uint qHash (const QPoint & key)
Also QHash
requires:
inline bool operator== (const QPoint & k1, const QPoint & k2)
but it's already defined.
Since qHash
is already implemented for 64-bit integers I believe that this solution has sense:
inline uint qHash (const QPoint & key)
{
return qHash (static_cast <qint64> (key.x () ) << 32 | key.y () );
}
Note: I don't know how to implement correct hash function which based on two 32-bit digits and output 32-bit hash.