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 <jwak...@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 via email to