[Development] Use of Standard Library containers in Qt source code

Matthew Woehlke mwoehlke.floss at gmail.com
Mon Jul 4 19:26:13 CEST 2016


On 2016-07-01 17:56, Thiago Macieira wrote:
> On sexta-feira, 1 de julho de 2016 22:13:42 PDT Giuseppe D'Angelo wrote:
>> Even today: where is QList::push_back(T&&)? Where are our emplacement
>> functions and their try versions? Where are our exception guarantees?)
> 
> We don't care about exceptions, so we won't be adding those.
> 
> As for the move-versions, since we can't take move-only types in our 
> containers due to the implicit sharing, does it really make a difference if we 
> have them or not?

Yes... and ironically, for the same reason implicit sharing is useful;
because the copy ctor might be horrendously expensive. Emplacement and
move-insert are (also) useful purely from a performance perspective.

> I would prefer the opposite: use non-Qt only if that is better than the Qt 
> equivalent. If you can't prove it or if it's too small, it's not worth the 
> difference in readability that it creates.

Option N+1: Convince the committee to adopt Qt's naming conventions and
convenience API's in STL2¹ ;-).

(¹ Or whatever it's being called...)

-- 
Matthew




More information about the Development mailing list