std.experimental.collections.rcstring and its integration in Phobos

jmh530 john.michael.hall at gmail.com
Wed Jul 18 14:14:08 UTC 2018


On Wednesday, 18 July 2018 at 11:56:39 UTC, Seb wrote:
> [snip]
>
> Yes, Array is a reference-counted Array, but it also has a 
> reference-counted allocator.
>

I see. Is it really a good idea to make the ownership/lifetime 
strategy part of the container? What happens when you want to 
make nogc collections for lists, trees, etc? You have to make 
multiple versions for unique/ref counted/some new strategy? I 
would think it is more generic to have it a separate wrapper that 
handles the ownership/lifetime strategy, like what exists in 
automem and C++'s smart pointers...though automem looks like it 
has a separate type for Unique_Array rather than including it in 
Unique...so I suppose that potentially has the same issue...


More information about the Digitalmars-d mailing list