Article View: comp.std.c++
Article #3810Re: double const declarations
From: James Kanze US/ESC 60/3/141 #407...
Date: Tue, 26 Mar 1996 16:23
Date: Tue, 26 Mar 1996 16:23
40 lines
2273 bytes
2273 bytes
In article <Pine.A32.3.91.960325093715.29874A-100000@zorglub.cae.ca>
dak <pierreba@poster.cae.ca> writes:
|> I've just encountered a problem in one of our template design and wondered
|> what could be done about it. It concerns const reference return value from
|> a templated member function, for example:
|> template <class T> class SmartPtr
|> {
|> // ... whatever:
|> public:
|> const T & Dereference ();
|> };
|> The problem arise when T is instantiated with a Container of constants:
|> SmartPtr<const int> a;
|> Here we have a double const which is not supported by the compiler, nor the
|> standard, I believe. Is there a fix or should we abandon all hope of using
|> const returns in templates ?
The draft standard forbids two explicit const's. If the duplicate
Const result from typedef's, etc., it's OK. (I don't know if the
actual words mention template instantiation types, but if they don't
I'm sure that it is an editorial oversight, and not the intent.)
--
James Kanze Tel.: (+33) 88 14 49 00 email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
Conseils, études et réalisations en logiciel orienté objet --
-- A la recherche d'une activité dans une region francophone
[ 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 ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Technical Details
Message-ID:
<9603261135.AA22454@lts.sel.alcatel.de>Path:
arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamageReferences:
<Pine.A32.3.91.960325093715.29874A-100000@zorglub.cae.ca>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage From: James Kanze US/ESC 60/3/141 #40763 <kanze@lts.sel.alcatel.de> Newsgroups: comp.std.c++ Subject: Re: double const declarations Date: 26 Mar 1996 16:23:07 GMT Organization: ? Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <9603261135.AA22454@lts.sel.alcatel.de> References: <Pine.A32.3.91.960325093715.29874A-100000@zorglub.cae.ca> NNTP-Posting-Host: taumet.eng.sun.com In-Reply-To: dak's message of 25 Mar 1996 10:09:28 PST Content-Length: 1279 X-Lines: 33 Originator: clamage@taumet