[Development] Question about QCoreApplicationData::*_libpaths
abbapoh at gmail.com
Fri Jan 15 11:28:32 CET 2016
I've already heard those arguments, however we _can't_ use std::vector in
API, because it's implementation may differ between compliers (gcc and
clang stdlibs, for example).
But we can use some features that implemented in the same way (std::pair or
You can continue to say how bad QVector is (and it is) but it will not be
thrown away in near future.
Same is for std::optional. Are they compatible between clang and gcc? (and
between different versions of gcc (std::unordered_map was not))
2016-01-15 14:20 GMT+03:00 Marc Mutz <marc.mutz at kdab.com>:
> On Friday 15 January 2016 03:58:12 Kevin Kofler wrote:
> > Иван Комиссаров wrote:
> > > Still, what about policy not to use std:: classes in Qt API?
> > So why not just add a QOptional that works the same as std::optional?
> a) because we can't (we don't yet require the necessary language features)
> b) because once introduced, people will add all kinds of Qt-specific stuff
> it, making it impossible to replace it with std::optional down the road.
> since it will be good enough for the low demands of Qt development, it
> no longer see development and fall behind the state of the art.
> Consider QVector: it has been Qt-ifed by both adding (technically) useless
> duplicate Qt-ish API, CoW, and a Qt-specific type classification scheme
> corresponding optimisations that make it very hard to argue for std::vector
> use instead. The Qt community had two decades where they could have
> the direction std::vector would take so it could allow the same
> that QVector has, but the time and energy was instead put into re-writing
> containers for every major release (yes, for Qt 5, too, and Thiago's Qt 6
> QVector again looks much different from the Qt 5 one).
> The CoW makes QVector slow and increase code size, leads to hidden detaches
> that not even Qt experts regularly avoid in their daily work, and doesn't
> work properly because you can take iterators into a QVector and, after
> the vector, change both copies through the iterator into the first. That
> is a
> conscious trade-off because making the container unsharable, as it must
> once it hands out iterators, would make CoW fail to take effect _all the
> But it leads to careless copying of QVectors that also doesn't really help
> with porting to std::vector.
> All the while - and I don't believe I'm saying this - std::vector *blazes
> trail* with move semantics, emplace_back and stateful allocators (making
> QVarLengthArray all but useless). Does QVector use move semantics? No. Does
> QVector have emplace_back? No. Does QVector have an allocator, even one
> citing Alexandrescu, actually deals with allocation? No. Does QVector, even
> with Q_PRIMITIVE_TYPE payloads, expand to less code as std::vector? No:
> https://codereview.qt-project.org/145587 (comment from 01-14 11:21). Does
> QVector have a debug mode comparable to that of std::vector
> Or: The only reason I ever used std::list was to use its splice() feature.
> Does QLinkedList have splice()? No, of course not. Because it _cannot_
> CoWed: how do you take ownership of nodes if the they are shared? By
> all other nodes in a detach()?).
> This is why we need to stop duplicating std API. It's not Qt's core
> to meddle with things we only have a half-interest in. It's fun to write
> QOptional. Until it isn't anymore. And then the (Qt) world needs to live
> the poor-man's std::optional for the next few decades.
> Please, no.
> 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 Experts
> Development mailing list
> Development at qt-project.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Development