public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: "François Dumont" <frs.dumont@gmail.com>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Do not use tuple-like interface for pair in unordered containers
Date: Wed, 11 Aug 2021 14:48:39 +0200	[thread overview]
Message-ID: <db4ed288-cb12-b14e-4be9-bc247c40b04a@gmail.com> (raw)
In-Reply-To: <YP7wGXMRnvWl1GEL@redhat.com>

Hi

     Sorry for the delay, I had just miss this message.

     I think you are clearly more expert than me for the changes you 
propose. I had a look at the patch and it seems just fine as it keeps 
the forwarding as expected. Nice simplification in 
_NodeBuilder<_Select1st>, we indeed only need to deal with std::pair 
type in this case.

François


On 26/07/21 7:25 pm, Jonathan Wakely wrote:
> On 23/07/21 19:21 +0100, Jonathan Wakely wrote:
>> I've been experimenting with this patch, which removes the need to use
>> std::tuple_element and std::get to access the members of a std::pair
>> in unordered_{map,multimap}.
>>
>> I'm in the process of refactoring the <utility> header to reduce
>> header dependencies throughout the library, and this is the only use
>> of the tuple-like interface for std::pair in the library.
>>
>> Using tuple_element and std::get resolved PR 53339 by allowing the
>> std::pair type to be incomplete, however that is no longer supported
>> anyway (the 23_containers/unordered_map/requirements/53339.cc test
>> case is XFAILed). That means we could just define _Select1st as:
>>
>>  struct _Select1st
>>  {
>>    template<typename _Tp>
>>      auto
>>      operator()(_Tp&& __x) const noexcept
>>      -> decltype(std::forward<_Tp>(__x).first)
>>      { return std::forward<_Tp>(__x).first; }
>>  };
>>
>> But the approach in the patch seems OK too.
>
> Actually I have a fix for PR 53339 so that we can support incomplete
> types again. So we don't want to access the .first member in the
> return type, as that requires a complete type.
>


      reply	other threads:[~2021-08-11 12:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-23 18:21 Jonathan Wakely
2021-07-26 17:25 ` Jonathan Wakely
2021-08-11 12:48   ` François Dumont [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=db4ed288-cb12-b14e-4be9-bc247c40b04a@gmail.com \
    --to=frs.dumont@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely@redhat.com \
    --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).