Newsgroups: comp.lang.c++
Path: utzoo!utgpu!news-server.csri.toronto.edu!torsqnt!geac!alias!rae
From: rae@alias.com (Reid Ellis)
Subject: Re: Read-only data access
Message-ID: <1991Jun17.150452.9472@alias.com>
Sender: news@alias.com (0000-news(0000))
Organization: Alias Research, Inc., Toronto ON Canada
References: <1654@balrog.ctron.com> <1991Jun13.211926.20276@lynx.CS.ORST.EDU> <SRA.91Jun14170332@pessoa.ecs.soton.ac.uk>
Date: Mon, 17 Jun 1991 15:04:52 GMT

Tim Budd <budd@fog.CS.ORST.EDU> writes:
|...I think some of the details are wrong (at least they don't work as
|planned using GNU 1.37).  The declaration needs to be int& const
|(reference to a constant), not const int & (constant reference).

Stephen Adams <sra@ecs.soton.ac.uk> writes:
|	class Z {
|	public:
|		int& const z;
 ...
|	};

The "const" goes in *front* of the "int".  What you're defining is a
constant reference to an int [a bit redundant, that] rather than a
reference to a constant int, which would be more like "const int &z".
See the ARM, section 8.4.3 on p 154, about halfway down.

					Reid
--
Reid Ellis                                                 _|\ |V| /|_
rae@utcs.toronto.edu        ||           rae@alias.com     \  \| |/  /
CDA0610@applelink.apple.com ||  +1 416 362 9181 [work]      >_______<
                                                                !
