Why can't we define re-assignable const reference variable?
Derek Parnell
derek at nomail.afraid.org
Tue Feb 19 16:19:44 PST 2008
On Tue, 19 Feb 2008 22:18:29 +0000, Janice Caron wrote:
> On 19/02/2008, Derek Parnell <derek at psych.ward> wrote:
>> Ok given this position and that 'string' is 'invariant(char)[]' then
>>
>> string s;
>>
>> makes 's' a reference to an immutable array,
>
> No, s is an array of immutable chars. Put another way, as I am sure
> you are well aware, s is a value type, ...
In that case, what did Walter really mean when he wrote:
>>>That's a good point, and a good reason why:
>>>
>>>invariant(C)[] c;
>>>invariant(int)[] i;
>>>
>>>should both have immutable array contents, i.e. if the contents of a
>>>reference is invariant then the reference itself should be invariant.
I took it that he was saying that 'c' and 'i' are references.
--
Derek
(skype: derek.j.parnell)
Melbourne, Australia
20/02/2008 11:17:17 AM
More information about the Digitalmars-d
mailing list