🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #117

Re: Is coercion to a reference defined?

#117
From: Marshall Cline
Date: Wed, 09 Sep 1992 04:58
18 lines
1306 bytes
In article <1992Sep6.182905.6603@cs.cornell.edu> moudgill@cs.cornell.edu ( Mayan Moudgill) writes:
...
>I'd like to define TWO functions:
>     operator T () { return _value;}
>and
>     operator T& () { return _value;}

They would, as stated, be ambiguous.  However, you can make the first one
a `const' member function, thereby disambiguating them based on the constness
of the object being converted to a T.

++Marshall
--
Marshall Cline
--
Marshall P. Cline, Ph.D. / Paradigm Shift, Inc / 65 N Main St/Norwood, NY 13668
cline@sun.soe.clarkson.edu / 315-353-4585 / FAX: 315-353-6100
Maintainer, C++ FAQ
Technical Details
Message-ID: <CLINE.92Sep8235800@sunspot.clarkson.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!darwin.sura.net!wupost!zaphod.mps.ohio-state.edu!rpi!clarkson!news.clarkson.edu!cline
References: <1992Sep6.182905.6603@cs.cornell.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++
Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!darwin.sura.net!wupost!zaphod.mps.ohio-state.edu!rpi!clarkson!news.clarkson.edu!cline
From: cline@sun.soe.clarkson.edu (Marshall Cline)
Subject: Re: Is coercion to a reference defined?
In-Reply-To: moudgill@cs.cornell.edu's message of Sun, 6 Sep 1992 18:29:05 GMT
Message-ID: <CLINE.92Sep8235800@sunspot.clarkson.edu>
Sender: news@news.clarkson.edu
Nntp-Posting-Host: sunspot.ece.clarkson.edu
Reply-To: cline@sun.soe.clarkson.edu (Marshall Cline)
Organization: Paradigm Shift, Inc (C++/Reuse/OOD/OO-mgmt training)
References: <1992Sep6.182905.6603@cs.cornell.edu>
Date: Wed, 9 Sep 1992 04:58:00 GMT
Lines: 18