[Development] QList

Marc Mutz marc.mutz at kdab.com
Sat Mar 18 22:51:08 CET 2017


On Saturday 18 March 2017 19:05:44 Thiago Macieira wrote:
> Em sábado, 18 de março de 2017, às 03:25:12 PDT, Ville Voutilainen escreveu:
> > >> 2) What do we plan to do about those problems?
> > > 
> > > Kill QList in Qt 6.
> > 
> > How much valid code will that break? How many bugs does that avoid?
> 
> A lot. I don't think we can have Qt 6 without a class called "QList". But
> we can make it be the same as QVector, which is what we want people to
> use. We can provide QArrayList as a replacement for anyone who needs
> pointer stability if they can't use QSet or QHash.

We dug us a very deep pit here. If you compare QPair's implementation with a 
typical std::pair's, you'll see that it's just totally pointless to keep 
classes alive that have 1:1 std equivalents. We'll just never get to the QOI 
of the std classes. Our time would be better spent fixing bugs in std 
implementations.

One reason I'm against keeping "QList" as a fully supported Qt container name 
is the unfortunate impedance mismatch (all Qt's fault) with std::list. I don't 
want Qt to continue to poison people's minds with that mixup. Just use 
QVector. Make QList a type-alias for QVector, but deprecate it. And use 
QVector in the API and the docs (or std::vector).

Our containers _still_ don't support move semantics correctly. Maybe Ville was 
hired to change that. If so, I'm sorry to say: what a waste of talent.

Thanks,
Marc

-- 
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt, C++ and OpenGL Experts



More information about the Development mailing list