A Refcounted Array Type
Namespace via Digitalmars-d
digitalmars-d at puremagic.com
Tue Feb 24 02:15:32 PST 2015
On Tuesday, 24 February 2015 at 10:13:36 UTC, matovitch wrote:
> On Tuesday, 24 February 2015 at 10:11:02 UTC, Namespace wrote:
>> On Tuesday, 24 February 2015 at 10:08:23 UTC, matovitch wrote:
>>> On Tuesday, 24 February 2015 at 09:44:13 UTC, Walter Bright
>>> wrote:
>>>> On 2/24/2015 1:32 AM, Jonathan M Davis via Digitalmars-d
>>>> wrote:
>>>>> The issue is that delete is considered @safe by the
>>>>> compiler,
>>>>
>>>> I thought more people would be interested in how to do a
>>>> memory safe reference counted container.
>>>
>>> This is really interesting ! Thought as a beginner, I am
>>> wondering why the counter need to be a pointer ?
>>
>> That's why:
>> ----
>> this(this)
>> {
>> if (count)
>> ++*count;
>> }
>> ----
>
> Hmm, I don't see why that's why... :(
It's more effective if you figure it out on your own.
But maybe this is a bit more clear?
https://github.com/Dgame/m3/blob/master/SmartPointer.d#L106
More information about the Digitalmars-d
mailing list