pass-by-ref semantics for structs (was Deque impl.)

Rainer Schuetze r.sagitario at gmx.de
Thu Jan 31 12:57:51 PST 2013



On 31.01.2013 21:55, Rainer Schuetze wrote:
>
>
> On 31.01.2013 21:48, Steven Schveighoffer wrote:
>> On Thu, 31 Jan 2013 15:32:23 -0500, Rainer Schuetze <r.sagitario at gmx.de>
>> wrote:
>>
>>> - how do you reference count immutable containers? You'll have to cast
>>> the payload to mutable and assume it is not in read-only memory.
>>
>> The reference count part is not immutable.
>>
>> e.g.:
>>
>> struct refcountstruct
>> {
>>     int count;
>>     immutable(containerimpl) impl;
>> }
>
> What about immutable(refcountstruct)? Maybe only implicitely as field of
> an immutable class.
>

That would probably be better immutable(refcountstruct*) as field of the 
immutable container struct.


More information about the Digitalmars-d mailing list