On Tue, Jun 11, 2019 at 11:31 AM Ulf Hermann <ulf.herm...@qt.io> wrote:
> I imagine that a vector which automatically sorts itself on the first > lookup after any changes if it's larger than X items could be a drop-in > replacement for most of the places where I misuse QHash or QMap. X could > be a template parameter or found by some heuristic. > I though about this as well. There's one caveat though. It can't be (easily) made COW (if we require it). If your lookup is non-mutable (i.e. `constFind` or w/e it's named), it'd mean that you have to mutate the data in a const method. This implies doing it (thread-)safely is going to get rather clumsy as there are 2 possibilities I see: 1) Detach in the `const` lookup if the data's dirty (i.e. not sorted) and then sort it, and then do the lookup. 2) Lock the data block, sort it and then do the lookup. Do I miss something?
_______________________________________________ Development mailing list Development@qt-project.org https://lists.qt-project.org/listinfo/development