[Development] QList

Marc Mutz marc.mutz at kdab.com
Fri Mar 31 09:43:11 CEST 2017


On Friday 31 March 2017 08:57:50 Simon Hausmann wrote:
> Hi,
> 
> To me this appears to be comparing the questions that new learning
> programmers have with questions of seasoned C++ programmers. I understand
> that we should cater both with Qt, but the topic at this point of the
> thread is the former group, not the latter.

Which questions do you think are beginner's and which ones are seasoned 
developer's questions?

What criteria do you use to put one in one bin and the other in the other?

People that use C++ without Qt have excellent online documentation, too[1]. 
And if they peruse it to find out how to fill a vector from a C array, then 
they will come across assign() and the range constructors. They start with Qt, 
and they miss these things.

Everyone learning C++ with the 2011 edition of the standard will be used to 
just throwing ranged-for at every container and suddenly a fat man in a 
YouTube video tells them that doing so with Qt containers performs a deep 
copy. Sure they have questions.

So, no, Qt containers are not more novice-friendly than STL containers, nor 
vice versa. They all leave something to be desired. Picking one part of the 
API and saying "this is why it's better/worse" will predicably be responded to 
by showing the other half of the picture.

But one thing the STL has going for it: once you do learn it, it lets you go 
farther with what you have learned than Qt. Once you learned the find() 
algorithm, you can apply it to every C++ container in the world, incl. C 
arrays and Qt containers. Incl. QFuture, which is a Qt container that - 
surprise - doesn't have indexOf() and contains().

Thanks,
Marc

[1] even better than Qt's, these days, since cppreference.com clearly shows 
what's available in which C++ version while Qt hides all but the latest 
documentation, which only describes the current state of affairs.

> Simon
> 
> > On 31. Mar 2017, at 08:41, Marc Mutz <marc.mutz at kdab.com> wrote:
> >> On Thursday 30 March 2017 22:32:35 Alejandro Exojo wrote:
> >>> On Wednesday 29 March 2017 20:11:58 Marc Mutz wrote:
> >>> I would really, really
> >>> like to know why QVector is easier to use? Because it has indexOf()?
> >>> Seriously, now?
> >> 
> >> Because it has _lots_ of easy to use member functions, and another kind
> >> of iterator that is also easier to use for some, and good
> >> documentation. I'm not making this stuff up:
> >> 
> >> http://stackoverflow.com/questions/571394/
> > 
> > Oh, I can play this game, too:
> > 
> > http://stackoverflow.com/questions/16559655/
> > http://stackoverflow.com/questions/38262041/
> > http://stackoverflow.com/questions/10153658/
> > http://stackoverflow.com/questions/35811053/
> > 
> >> Hundreds of votes for something immensely simple, that with Qt
> >> containers is also immensely more readable. Ease of use has a lot more
> >> value than performance to many people. A thought: how many comments did
> >> get the blog post that you did on making QRegion iterable? And how many
> >> the one about the removal of the foreach macro?

-- 
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