Date: Mon, 2 Oct 2023 20:18:17 +0100
On Mon, 2 Oct 2023 at 19:37, Hans Åberg <haberg-1_at_[hidden]> wrote:
>
>
> > On Oct 2, 2023, at 11:33, Aaron Gray via Std-Discussion <std-discussion_at_[hidden]> 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;
>
> When working with namespaces, it used to be that one had to put the hash function in std:
>
> namespace my {
> …
> } // namespace my
>
> namespace std {
> template<> struct hash<mli::level> {
> size_t operator()(my::type_t& x) const {
> return std::hash<unsigned>()(x.top) ^ std::hash<unsigned>()(x.bot);
> }
> };
> } // namespace std
>
> namespace my {
> …
> } // namespace my
Hans,
Yes that had crossed my mind, thanks for verifying this.
Aaron
>
>
> > On Oct 2, 2023, at 11:33, Aaron Gray via Std-Discussion <std-discussion_at_[hidden]> 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;
>
> When working with namespaces, it used to be that one had to put the hash function in std:
>
> namespace my {
> …
> } // namespace my
>
> namespace std {
> template<> struct hash<mli::level> {
> size_t operator()(my::type_t& x) const {
> return std::hash<unsigned>()(x.top) ^ std::hash<unsigned>()(x.bot);
> }
> };
> } // namespace std
>
> namespace my {
> …
> } // namespace my
Hans,
Yes that had crossed my mind, thanks for verifying this.
Aaron
Received on 2023-10-02 19:18:34