A Refcounted Array Type

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 24 16:19:39 PST 2015


On 2/24/2015 2:27 PM, deadalnix wrote:
> This may not be @safe depending on the type of E.

The code is a template, and so relies on inference.


> Also, this do not really solve the garbage problem

Steven pointed out the correct fix for that.


> Also, there are no way to ensure that the array is going to be bound to one
> thread, even without shared (exception, delegate, destructor, pure return). You
> need at least atomic increment and/or decrement.

No. The correct solution is to fix any cases of implicit sharing. If they don't 
have bugzilla issues, file them.


> I have to admit, that is pretty cool. But it is only gonna work with value types.

I don't see that limitation at all.


> You need bound check: end <= start <= array.length

See the antecedent:

"More could be done:
[...]
5. bounds checking"



More information about the Digitalmars-d mailing list