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

Ville Voutilainen ville.voutilainen at gmail.com
Sun Apr 16 20:54:03 CEST 2017


On 16 April 2017 at 20:51, Giuseppe D'Angelo <giuseppe.dangelo at kdab.com> wrote:
> Il 16/04/2017 18:32, Corentin ha scritto:
>>
>> More on point:
>>    * You don't actually need to include anything from the STL to
>> implement std::hash.
>
> You actually do: you need <functional> to see the primary template for
> std::hash (otherwise you can't specialize it). Also, how to implement it
> is another burden (see the other discussion).

You don't need to include a header to do that:

namespace std {
    template <class T> struct hash;
}

Now you can specialize hash for your own types.

I don't think that violates any rule; it's not adding a declaration to
namespace std, as that
declaration is already there.



More information about the Development mailing list