A Refcounted Array Type

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 24 14:16:50 PST 2015


On Tuesday, 24 February 2015 at 15:51:42 UTC, Andrei Alexandrescu 
wrote:
> On 2/23/15 6:05 PM, Walter Bright wrote:
>> On 2/23/2015 5:41 PM, weaselcat wrote:
>>> On Monday, 23 February 2015 at 22:15:54 UTC, Walter Bright 
>>> wrote:
>>>>    ref E opIndex(size_t i) return // here's the magic
>>>
>>> exactly what is this doing? I don't see this explained in 
>>> DIP25 at all.
>>
>> The 'this' is passed by reference. So the 'return' is really 
>> 'return ref
>> this', the rest is explained by DIP25.
>
> We should amend DIP25 to explain that "this" is handled like a 
> parameter. -- Andrei

Note that I'm not surprised by that behavior (this is indeed ref 
for struct). But this is not ref for classes, which will defeat 
DIP25.


More information about the Digitalmars-d mailing list