public inbox for
 help / color / mirror / Atom feed
From: Jonathan Wakely <>
To: Patrick Palka <>
Subject: Re: [PATCH 1/2] libstdc++: Optimize is_void and is_null_pointer
Date: Wed, 7 Sep 2022 09:19:39 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Wed, 7 Sept 2022 at 01:46, Patrick Palka via Libstdc++
<> wrote:
> Instead of defining these in terms of a helper class template
> and the relatively expensive __remove_cv_t, just declare four
> explicit specializations of the main template, one for each choice
> of cv-quals.
> Tested on x86_64-pc-linux-gnu, does this look OK for trunk?

Yes, and we should do the same for is_void_v and  is_null_pointer_v.
Even though the class templates they instantiate will be cheaper now,
they can still avoid any class template instantiation.

> The is_void change alone reduces memory usage for by
> almost 1%.

Also in my queue of trait refactoring, but I haven't tested if these
are worth doing yet:

template<typename T>
  struct is_object : is_const<const T>::type { };
  struct is_object<void> : false_type { };
  struct is_object<const void> : false_type { };
// and so on for volatile and const volatile

And we could define is_object_v as simply is_const_v<const T> && is_void_v<T>.

Improving is_object should benefit <ranges> and also the is_scalar
change proposed at

      parent reply	other threads:[~2022-09-07  8:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-07  0:45 Patrick Palka
2022-09-07  0:45 ` [PATCH 2/2] libstdc++: Optimize is_reference Patrick Palka
2022-09-07  8:00   ` Jonathan Wakely
2022-09-07  8:19 ` 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:

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

  git send-email \ \ \ \ \ \

* 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).