public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tim Song <t.canens.cpp@gmail.com>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: "libstdc++" <libstdc++@gcc.gnu.org>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [committed] libstdc++: Make ranges CPOs final and not addressable
Date: Tue, 15 Jun 2021 15:32:12 -0500	[thread overview]
Message-ID: <CAPQZVxt_E7u5OHB4dMf7VXzWL_cyF-xVj+TGwQaGWzN2WNj9cA@mail.gmail.com> (raw)
In-Reply-To: <YMjxP4uzHl48WSr5@redhat.com>

CPOs are specified as actual semiregular function objects that can be
copied and constructed freely, so it seems a bit hostile to make them
final/non-addressable? (It's debatable whether the type of a CPO is a
type "specified in the C++ standard library" for which [derivation]/4
would apply.)


On Tue, Jun 15, 2021 at 1:34 PM Jonathan Wakely via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> This restricts the API of the CPOs and other function objects so they
> cannot be misused by deriving from them or taking their addresses.
>
> Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
>
> libstdc++-v3/ChangeLog:
>
>         * include/bits/ranges_base.h (ranges::begin, ranges::end)
>         (ranges::cbegin, ranges::cend, ranges::rbeing, ranges::rend)
>         (ranges::crbegin, ranges::crend, ranges::size, ranges::ssize)
>         (ranges::empty, ranges::data, ranges::cdata): Make types final.
>         Add deleted operator& overloads.
>         (ranges::advance, ranges::distance, ranges::next, ranges::prev):
>         Likewise.
>         * testsuite/std/ranges/headers/ranges/synopsis.cc: Replace
>         ill-formed & expressions with using-declarations. Add checks for
>         other function objects.
>
> Tested powerpc64le-linux. Committed to trunk.
>

  reply	other threads:[~2021-06-15 20:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-15 18:28 Jonathan Wakely
2021-06-15 20:32 ` Tim Song [this message]
2021-06-15 21:33   ` Jonathan Wakely
2021-06-16 13:37     ` 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=CAPQZVxt_E7u5OHB4dMf7VXzWL_cyF-xVj+TGwQaGWzN2WNj9cA@mail.gmail.com \
    --to=t.canens.cpp@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).