std.container and classes
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sat Dec 17 22:15:40 PST 2011
On 12/17/11 7:52 PM, Jonathan M Davis wrote:
> The only reason that I can think of to use a reference-counted struct instead
> of a class is becuse then it's easier to avoid the GC heap entirely. Almost
> all of a container's memory is going to end up on the heap regardless, because
> the elements almost never end up in the container itself.
Being on the heap is not the main issue. The main issue is the data
becoming garbage once all references are gone.
> They're in a dynamic
> array or in nodes or something similar. So, whether the container is ref-
> counted or a class is almost irrelevant.
I think this argument is starting off the wrong premise, and is already
wrong by this point, so I skipped the rest. Am I right?
Andrei
More information about the Digitalmars-d
mailing list