public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: "François Dumont" <frs.dumont@gmail.com>
Cc: "libstdc++@gcc.gnu.org" <libstdc++@gcc.gnu.org>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Enhance unordered container merge
Date: Mon, 15 Nov 2021 09:10:55 +0000	[thread overview]
Message-ID: <CAH6eHdRz4MxVSfYRWfYViotxGWQgcqmdM+2tUgnv0K9Rq8=isA@mail.gmail.com> (raw)
In-Reply-To: <3e66557c-131e-eed0-fc7c-3d1eefd1dcf9@gmail.com>

On Mon, 15 Nov 2021 at 06:00, François Dumont wrote:
>
> On 15/11/21 12:25 am, Jonathan Wakely wrote:
> > On Sun, 14 Nov 2021 at 13:31, François Dumont via Libstdc++
> > <libstdc++@gcc.gnu.org> wrote:
> >>       libstdc++: Unordered containers merge re-use hash code.
> >>
> >>       When merging between 2 unordered containers with same hasher we can
> >> re-use
> >>       the cached hash code if any.
> > Instead of introducing the _ReuseOrComputeHash type, wouldn't it be
> > simpler to just overload _M_hash_code?
> >
> >
> >      // Same hash function, use the cached hash code.
> >      __hash_code
> >      _M_hash_code(const _Hash&,
> >          const _Hash_node_value<_Value, true>& __n) const
> >      { return __n._M_hash_code; }
> >
> >    // Compute hash code using a different hash function, _H2
> >    template<typename _H2>
> >     __hash_code
> >     _M_hash_code(const _H2&,
> >         const _Hash_node_value<_Value, __cache_hash_code>& __n) const
> >     { return this->_M_hash_code(_ExtractKey{}(__n._M_v()); }
> >
> > The first overload is more specialized, so will be chosen when the
> > first argument is the same type as _Hash and the cache_has_code
> > boolean is true.
>
> Yes, it is simpler.
>
> Ok to commit ?

Yes, thanks.

      reply	other threads:[~2021-11-15  9:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-14 13:29 François Dumont
2021-11-14 23:25 ` Jonathan Wakely
2021-11-15  6:00   ` François Dumont
2021-11-15  9:10     ` Jonathan Wakely [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH6eHdRz4MxVSfYRWfYViotxGWQgcqmdM+2tUgnv0K9Rq8=isA@mail.gmail.com' \
    --to=jwakely.gcc@gmail.com \
    --cc=frs.dumont@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).