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

Kevin Kofler kevin.kofler at chello.at
Sat Apr 15 22:18:06 CEST 2017


Marc Mutz wrote:
> The underlying issue is that any user-specialisation of std::hash should
> delegate to a stdlib-provided one, because implementations are free to add
> seeding, and, lacking an extra argument, the only way to incorporate the
> seed is to call a library-provided specialisation.
> 
> So while it's trivial to add std::hash specialisations for something like
> QVector, QSizePolicy or QPoint (but not QPointF, because its op== is
> broken), I currently don't see how we could add them for QString or
> QByteArray, at least without looping over std::hash<char>, which imo is a
> no-no.

Why not have the std::hash implementation for Qt types just call qHash(foo, 
qGlobalQHashSeed())? Who cares about the STL's seeding if you can just use 
your own?

        Kevin Kofler




More information about the Development mailing list