Article View: comp.std.c++
Article #3170Re: Give operator. a chance
From: Jason Merrill
Date: Thu, 01 Feb 1996 00:07
Date: Thu, 01 Feb 1996 00:07
34 lines
1795 bytes
1795 bytes
>>>>> Joe Buck <jbuck@Synopsys.COM> writes:
> Stroustrup proposes that operator. only forward to the resulting class
> for a.m if the object itself doesn't have a member m. I dislike that
> approach; it is unnecessary since (&a)->m accesses it, and since
> the class is going to present itself as a disguised reference object
> in any case, only private code is going to mess around with the object's
> own members. In member functions, one would merely write "m".
I think a more natural way to achieve the delegation semantics proposed by
Stroustrup would be to extend 'using' along these lines:
struct A {
void f ();
};
struct ARef {
A* a;
using *a;
};
main ()
{
ARef ar = { new A };
ar.f (); // (*(ar.a)).f();
}
Of course, that's not likely to happen either.
Jason
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<u9pwc00wqn.fsf@yorick.cygnus.com>Path:
arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamageReferences:
<3102AD11.1663@et.se> <4e0nc3$4dp@engnews1.eng.sun.com> <4e90k4$gqr@hermes.synopsys.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage From: jason@cygnus.com (Jason Merrill) Newsgroups: comp.std.c++ Subject: Re: Give operator. a chance Date: 1 Feb 1996 00:07:02 GMT Organization: Cygnus Support, Mountain View, CA Sender: jason@cygnus.com Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <u9pwc00wqn.fsf@yorick.cygnus.com> References: <3102AD11.1663@et.se> <4e0nc3$4dp@engnews1.eng.sun.com> <4e90k4$gqr@hermes.synopsys.com> NNTP-Posting-Host: taumet.eng.sun.com Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Nntp-Posting-Host: yorick.cygnus.com In-Reply-To: jbuck@Synopsys.COM's message of 26 Jan 1996 00:05:36 GMT X-Newsreader: Gnus v5.0 X-Lines: 30 Content-Length: 788 Originator: clamage@taumet