Is it possible to make QSet of QDateTime in general? Cause I've got following:
Thanks in advance!no matching function for call to 'qHash(const QDateTime&)'
Is it possible to make QSet of QDateTime in general? Cause I've got following:
Thanks in advance!no matching function for call to 'qHash(const QDateTime&)'
Not without extra effort, for the reason stated in the error message. From the QSet docs:
QDateTime already has an operator==() but you will have to provide a qHash(const QDateTime &datetime) function. See the QHash docs for an example of how to do this.QSet's value data type must be an assignable data type. You cannot, for example, store a QWidget as a value; instead, store a QWidget *. In addition, the type must provide operator==(), and there must also be a global qHash() function that returns a hash value for an argument of the key's type. See the QHash documentation for a list of types supported by qHash().
Thank you for such prompt and comprehensive answer!
So I will stick with using QSet<QString> and get QString with QDateTime::toString method.
Bookmarks