From -3852711398815762501
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,5e0145d162a6d1d6
X-Google-Attributes: gidf78e5,public
From: "Daniel Parker" <danielp@nospam.com>
Subject: Re: Why is granting friendship to a templ. parameter ill-formed?
Date: 1998/03/17
Message-ID: <6ejjqf$km9$1@news.interlog.com>#1/1
X-Deja-AN: 334712813
References: <6dop9s$kq6$1@news.utu.fi> <35005B2A.7410@cs.wayne.edu> <1yiuppeaon.fsf@dshp01.ntc.nokia.com> <6e2i9u$rig$1@news.interlog.com> <350587D6.3EA6@cs.wayne.edu> <35069238.1C1DAA80@physik.tu-muenchen.de> <35082F4C.44C3@usa.net>
X-Original-Date: Mon, 16 Mar 1998 11:21:14 -0000
X-Mimeole: Produced By Microsoft MimeOLE V4.72.2106.4
Organization: Interlog Internet Services
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUANQ2+7uEDnX0m9pzZAQGxYwF+Lj07XNAyy793z6/dafFCHpvFX2CQ2R25 4GPm0GPHMw58aRoYU8r+1h4loTRWjBU3 =Zzmv
Newsgroups: comp.std.c++


Srinivas Vobilisetti wrote in message <35082F4C.44C3@usa.net>...
>Christopher Eltschka wrote:
>>
>What actually I meant is something
>like the following:
>
>class A {
>};
>
>class B {
>};
>
>class C {
>};
>
>class D {
>};
>
>template <class T> class X {
>
>friend class T = A, B, C;
>
>// [...]
>};
>
>The statement "friend class T = A, B, C;" means class A is friend of
>class X<A>, class B is friend of class X<B> and class C is friend of
>class X<C> but class D is not a friend of class X<D>. It also means
>class A is not a friend of class X<S != A>.
>
>By doing this, template class X knows what all classes have access to
>its private members. Otherwise, template classes will turn out to be a
>maintenance nightmare.

But surely this depends on context.  If I design a class that can take
plugins in the form of a template parameter, and if I follow your policy by
explicitly listing each plugin as a friend, then, in order to add another
plugin, a client would have to modify this list of friends, which is code
that he may not own.  This would certainly lead to a much bigger maintenance
nightmare.

--
Please do not use reply, use danielp@anabasis.com instead.
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]



