public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Patrick Palka <ppalka@redhat.com>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: Pilar Latiesa <pilarlatiesa@gmail.com>,
	ppalka@redhat.com,  libstdc++@gcc.gnu.org,
	gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] libstdc++: Allow adjacent __maybe_present_t<false, ...> to overlap
Date: Tue, 2 Apr 2024 13:18:13 -0400 (EDT)	[thread overview]
Message-ID: <5db417d9-52e9-e701-2644-5802148e8339@idea> (raw)
In-Reply-To: <CAH6eHdQAbZLZWVzzs40vNBK7xJOwQMxvNbBcVpQaLPjbWcypKA@mail.gmail.com>

On Tue, 2 Apr 2024, Jonathan Wakely wrote:

> On Tue, 2 Apr 2024 at 18:00, Pilar Latiesa wrote:
> >
> > Just out of curiosity: would this also work?
> >
> > template<typename _Tp, typename _Disc>
> > struct _Absent {};
> >
> > template<bool _Present, typename _Tp, typename _Disc = decltype([]{})>
> > using __maybe_present_t = __conditional_t<_Present, _Tp, _Absent<_Tp, _Disc>>;
> >
> > That would avoid having to type 0, 1, ... manually.
> 
> This is subjectively horrible and, more objectively, would create
> longer mangled names and additional RTTI.

Yeah, it's a neat trick but probably not appropriate to use within the
standard library.

Another reason to avoid it is that GCC's support for lambdas within
template arguments has some known bugs (e.g. PR107457 but that should
hopefully be fixed soon).


  reply	other threads:[~2024-04-02 17:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02 16:59 Pilar Latiesa
2024-04-02 17:01 ` Jonathan Wakely
2024-04-02 17:18   ` Patrick Palka [this message]
2024-04-02 19:41     ` Pilar Latiesa
  -- strict thread matches above, loose matches on Subject: below --
2024-04-01 22:15 Patrick Palka
2024-04-02  9:17 ` Jonathan Wakely

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=5db417d9-52e9-e701-2644-5802148e8339@idea \
    --to=ppalka@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    --cc=libstdc++@gcc.gnu.org \
    --cc=pilarlatiesa@gmail.com \
    /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).