🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

double const declarations

#3800
From: dak
Date: Mon, 25 Mar 1996 18:09
25 lines
1544 bytes
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 ?
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]
Technical Details
Message-ID: <Pine.A32.3.91.960325093715.29874A-100000@zorglub.cae.ca>
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austern

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austern
From: dak <pierreba@poster.cae.ca>
Newsgroups: comp.std.c++
Subject: double const declarations
Date: 25 Mar 1996 10:09:28 PST
Organization: -
Approved: austern@isolde.mti.sgi.com
Message-ID: <Pine.A32.3.91.960325093715.29874A-100000@zorglub.cae.ca>
NNTP-Posting-Host: isolde.mti.sgi.com
X-Original-Date: Mon, 25 Mar 1996 09:45:54 -0500 (EST)
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBVAwUBMVbhY0y4NqrwXLNJAQGmogIAtmlb94IbqpHwSnOeojPLPr2BWNWMzauC
 ezMEPYWCtZr7QtGJ3MhS14bElN49WNjzc58xI00vK/YqbTt60LQevg==
 =T/R0
Originator: austern@isolde.mti.sgi.com