[Development] QHash for Qt 6

Vitaly Fanaskov vitaly.fanaskov at qt.io
Fri Dec 20 13:54:47 CET 2019


This is not that easy to use std::* containers because at least the following issues have to be addressed:

  *   Memory management
  *   Binary compatibility
  *   Implementation consistency

You probably can provide, for example, some allocators, relax compatibility requirements and so on...  The question only is whether this is worth doing or not.

Personally I tend thinking that this is better to maintain, extend and improve what we already have rather than address the issues listed above. Again, this is just a personal opinion.

We should probably perform some research here.

On 12/20/19 11:47 AM, Giuseppe D'Angelo via Development wrote:
Il 20/12/19 09:23, Lars Knoll ha scritto:
The result was that QHash has clear weaknesses compared to other implementations. It uses too much memory and certainly isn’t the fastest implementation. But std::unordered_map is just as bad, so there’s no point in using that to implement QHash.

Just to be devil's advocate, there is... As much as it's fun and everything implementing a container, just using std::unordered_map would have minimal effort on our side ("someone else's problem", and it's not even a random 3rd party, but a mandatory prerequisite for building Qt), and we can put in our API move-conversion between QHash / std::unordered_map.

I stopped thinking that Qt should provide "special" data structures (and for sure we should kill any QHash/QMap usage in our APIs); QHash can be as bad (or as good) as std::unordered_map, and if people need something more tailored for their use cases, there's plenty of 3rd parties to choose from. Or is there a political agenda here trying to promove QHash usage? :-)

Is the plan to also have QMap be backed by an hybrid solution (array-backed, etc.), or std::map, or something else?

My 2 c,




_______________________________________________
Development mailing list
Development at qt-project.org<mailto:Development at qt-project.org>
https://lists.qt-project.org/listinfo/development


--
Best Regards,

Fanaskov Vitaly
Senior Software Engineer

The Qt Company / Qt Quick and Widgets Team
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20191220/a8be6db0/attachment-0001.html>


More information about the Development mailing list