C++ Logo

std-discussion

Advanced search

Re: Trying to solve how to do a std::unordered_map<std::pair<..., ...>, ...>

From: Aaron Gray <aaronngray.lists_at_[hidden]>
Date: Mon, 2 Oct 2023 20:01:17 +0100
On Mon, 2 Oct 2023 at 19:45, Edward Catmur via Std-Discussion
<std-discussion_at_[hidden]> wrote:
>
> And don't try to specialize hash on unconstrained std::pair; it isn't yours. Write a separate hash class to use explicitly if you must.

Edward,

So this is okay :-

    template<>
    struct hash<pair<Type *, Type *>> { .. }

but

    template<typename T>
    struct hash<pair<T *, T *>> { .. }

is not ?

Aaron

Received on 2023-10-02 19:01:36