Date: Mon, 2 Oct 2023 18:39:56 +0100
On Mon, 2 Oct 2023 at 11:30, Bo Persson via Std-Discussion
<std-discussion_at_[hidden]> wrote:
>
> On 2023-10-02 at 11:33, Aaron Gray via Std-Discussion wrote:
> > I am trying to work out how to do a :-
> >
> > std::unordered_map<std::pair<const Type *, const Type*>, bool,
> > std::hash<Type>> subTypeMemorization;
> >
> > Given a barebones class Type :-
> >
> > class Type {
> > public:
> > std::string name;
> > ....
> > };
> >
> > Godbolt attempted example :-
> >
> > https://godbolt.org/z/r4YrG841E
> >
>
> The hash should not be for 'Type', but for the whole key
> 'std::pair<const Type *, const Type*>'.
I am more interested in hashing based on the semantics rather than
pointers or data based constructs.
> And, BTW, doesn't mapping to a bool look very similar to a set?
Its a two dimensional cross product space.
Aaron
<std-discussion_at_[hidden]> wrote:
>
> On 2023-10-02 at 11:33, Aaron Gray via Std-Discussion wrote:
> > I am trying to work out how to do a :-
> >
> > std::unordered_map<std::pair<const Type *, const Type*>, bool,
> > std::hash<Type>> subTypeMemorization;
> >
> > Given a barebones class Type :-
> >
> > class Type {
> > public:
> > std::string name;
> > ....
> > };
> >
> > Godbolt attempted example :-
> >
> > https://godbolt.org/z/r4YrG841E
> >
>
> The hash should not be for 'Type', but for the whole key
> 'std::pair<const Type *, const Type*>'.
I am more interested in hashing based on the semantics rather than
pointers or data based constructs.
> And, BTW, doesn't mapping to a bool look very similar to a set?
Its a two dimensional cross product space.
Aaron
Received on 2023-10-02 17:40:15