C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] This deduction and access control
From: Magnus Fromreide (magfr_at_[hidden])
Date: 2020-07-20 07:43:27


On Sun, Jul 19, 2020 at 09:47:39AM -0400, Jason McKesson via Std-Proposals wrote:
> On Sun, Jul 19, 2020 at 7:43 AM Magnus Fromreide via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> >
> > On Sun, Jul 19, 2020 at 07:02:22AM +0100, Gašper Ažman wrote:
> > > You are correct, it does not. You will have to mark the method as a friend
> > > in derived.
> >
> > Ok, so under this proposal a using-declaration of a method from a parent
> > ain't enough to grant the use of it from a child.
> >
> > I also noticed that this is very close to Universal Functions (N4165),
> > but slightly limited (can only be declared as members).
>
> No, it's not. It's nothing like that proposal. Just look at the
> proposal's abstract, and you'll see that what it provides has nothing
> to do with P0847.

Now, P0847R0 do have a reference to UFCS (2.13) and that explains why UFCS
are not enough to solve the problem on it's own but R1 have dropped that
section.

> That proposal is about allowing you to use member
> call syntax to call non-member functions. This proposal has nothing to
> do with function calls themselves.

When calling a deduced this member

  instance.deduced_this_member(a, b);

then that is interpreted as

   deduced_this_member(instance, a, b);

This looks exactly like what N4165 proposed albeit restricted to only
deduced this members and that is why I asked. It could very well be that
limiting it to only deduced this members solves all the problems.

/MF


STD-PROPOSALS list run by herb.sutter at gmail.com

Standard Proposals Archives on Google Groups