Understanding RefCounted

JG someone at somewhere.com
Thu May 13 04:22:27 UTC 2021


On Thursday, 13 May 2021 at 00:53:50 UTC, Steven Schveighoffer 
wrote:
> On 5/12/21 1:16 PM, JG wrote:
>> [...]
>
> Ah, ok. So reference counting provides a single thing you can 
> point at and pass around without worrying about memory cleanup. 
> But only as long as you refer to it strictly through a 
> RefCounted struct. If you keep a pointer to something in the 
> payload that isn't wrapped in a RefCounted struct (and 
> specifically the original RefCounted struct), then it's 
> possible the RefCounted struct will free the memory while you 
> still hold a reference.
>
> [...]

Thank you. I was just wondering if something like what you wrote 
could be achieved using the range above accidentally.


More information about the Digitalmars-d-learn mailing list