public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: "François Dumont" <frs.dumont@gmail.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: Mon, 26 Jul 2021 18:25:45 +0100	[thread overview]
Message-ID: <YP7wGXMRnvWl1GEL@redhat.com> (raw)
In-Reply-To: <YPsIwna/zCXgk1MI@redhat.com>

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-07-26 17:25 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 [this message]
2021-08-11 12:48   ` François Dumont

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=YP7wGXMRnvWl1GEL@redhat.com \
    --to=jwakely@redhat.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).