Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

local classes of befriended classes

32 views
Skip to first unread message

Fraser Ross

unread,
Aug 7, 2018, 6:29:00 AM8/7/18
to
When a class is befriended, local classes of the befriended class share
that befriending.

I don't feel that the C++ standard gives an example.

Fraser.

Alf P. Steinbach

unread,
Aug 7, 2018, 12:15:05 PM8/7/18
to
Rather, if you're asking for people here to help clarify something then
it's your responsibility to provide an example. Or at least a reference
to the wording that bothers you. Remember that there are a number of C++
standards (98, 03, 11, 14, 17) with slightly different numbering.

Cheers!,

- Alf


Jorgen Grahn

unread,
Aug 7, 2018, 3:23:02 PM8/7/18
to
On Tue, 2018-08-07, Alf P. Steinbach wrote:
> On 07.08.2018 12:28, Fraser Ross wrote:
>> When a class is befriended, local classes of the befriended class share
>> that befriending.
>>
>> I don't feel that the C++ standard gives an example.
>
> Rather, if you're asking for people here to help clarify something then
> it's your responsibility to provide an example. Or at least a reference
> to the wording that bothers you.

It's not clear that anything /is/ bothering him.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .

Fraser Ross

unread,
Aug 8, 2018, 5:15:22 AM8/8/18
to
Using the draft N4750 at 12.4 local class declarations, there is nothing
about friends. At 14.3 friends, it says "Declaring a class to be a
friend implies that the names of private and protected members from the
class granting friendship can be accessed in the base-specifiers and
member declarations of the befriended class." Thats all there is on
this. Nowhere does it say directly that when a class is befriended,
local classes of the befriended class share that befriending.

Fraser.

Bo Persson

unread,
Aug 8, 2018, 5:47:22 AM8/8/18
to
Local classes are included in the term "member declarations". It doesn't
say just "member functions", so includes all types of members.



Bo Persson

Fraser Ross

unread,
Aug 8, 2018, 6:38:55 AM8/8/18
to
I know that. It lacks any detail about local classes.

Fraser.

James Kuyper

unread,
Aug 8, 2018, 7:09:04 AM8/8/18
to
True - but it does say it indirectly:

"... The local class is in the scope of the enclosing scope, and has the
same access to names outside the function as does the enclosing
function." (9.8p1). Since the friend declaration gave the enclosing
function access to those members, the local class will have that same
access.
0 new messages