[Development] How to include Standard Library headers from Qt ones?

André Pönitz apoenitz at t-online.de
Sun Apr 16 15:15:00 CEST 2017


On Sat, Apr 15, 2017 at 12:49:35AM +0200, Giuseppe D'Angelo wrote:
> Howdy,
> 
> I'm looking for a resolution regarding the problem of including Standard
> Library headers from Qt ones. Most notably, I'd like to find a solution
> for the problems of:
> 
> * Q_DECLARE_TYPEINFO over suitable Standard Library datatypes;
> * defining qHash over suitable Standard Library datatypes;
> * defining std::hash specializations for suitable Qt datatypes;
> * ...
> 
> (A separate discussion is whether introducing those declarations in Qt
> 5.x would constitute an acceptable SIC / BIC. I'm not fully sure the
> relative QUIP solves this.)
> 
> So, how and where should we add such definitions?

Lacking heavy qualification I don't see much of a "we" here anymore.
Instead, I see a divide between people who just use, and intent to be
able to use in the future, Qt, and people who consider the Qt (Core,
even) code base as their personal playground.

A while ago, it was *much* cheaper to #include <QString> than <string>,
and the resulting faster compile times were seen as one of the benefits
of Qt, independent of the added utility of the actual class.

Thanks to the the contributions of some "we", "we" (other) ended up in a
situation where the utility of Qt was continuously reduced (small
translation unit were one them), or removed (say, algorithms operating
on full containers).

> The biggest issue to solve would be the fact that, in order to provide
> definitions for types from the Standard Library, one needs to include
> *a lot* of Standard Library headers from Qt ones (think of the qHash
> overloads).

If this were meant to be a serious process, you'd start with making a
point on what benefits a user would have from solving what you call
"problems" and let people judge whether this is something that helps or
hurts them. I call myself a "plain user of Qt" more often than not, and
I have never seen any of the issues from your list close to anything
that I'd consider a serious issue in real life.

Since the flurry of last years' microoptimizations in the QString and
algorithm area had measurably negative impact on me (like time I had to
spend to work around SC breakages), but no measurable positive impact
(should I have witnessed any performance gains?) I reserve the right to
be sceptical here, unless something resembling a proof of the opposite
shows up.

Andre'




More information about the Development mailing list