[Development] QHash<const char*,..>

Lars Knoll lars.knoll at qt.io
Thu Jan 18 15:15:56 CET 2018

> On 18 Jan 2018, at 15:12, René J.V. Bertin <rjvbertin at gmail.com> wrote:
> Hi,
> It took me a while to figure out why my QHash map of a const char* to something else didn't work despite containing the expected key,value combinations. I understand that the bug was in my code rather than in QHash, because the class is not designed to work with basic data types.

It does work with basic data types. It just did something else than you maybe expected (hashing on the value of the char * pointer, not on the string behind it).
> It could help though if a compiler error were raised in this kind of situation, would that be possible?

No, because hashing on pointer values is a completely valid use case.


More information about the Development mailing list