QHash implementation for QDate and QDateTime
-
Suggest a qHash implementation for QDate and QDateTime that has the least performance penalty.
The implementation having the highest performance will be one that uses plain integer values and bitwise operations.
The following integer properties will be used for:- QDate: year/month/day
- QDateTime: year/month/day/hour/minute/second/millisecond
An implementation that would give a unique result is the following:
Transform the QDate/QDateTime to string using the following templates:
QDate: yyyy/MM/dd
QDateTime: yyyy/MM/dd/hh/mm/ss/zzzuse the already provided qHash( const QString& ) function to generate the hash code
Such implementation has a great performance overhead since strings are involved instead of plain integer values.
I am curious to find out why QDate and QDateTime doesn't have a qHash implementation companions in the QtSDK.
Are there implementation specifics that prevent those Qt integral types from being qHash-ed? -
You might want to file your suggestion in "JIRA":https://bugreports.qt.nokia.com/secure/Dashboard.jspa
In this forum you might get some feedback from others on your suggestion, but the Qt development team is not tracking feature suggestions here. -
I'll do it right now.
-
Thanks. You may want to publish a link to your suggestion here. This allows others in favor of your suggestion to vote for it.
-