Creating a reference counted type?
Gary Willoughby via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jun 12 07:31:50 PDT 2016
On Sunday, 12 June 2016 at 14:29:19 UTC, Gary Willoughby wrote:
> Another thing that is puzzling me is that when creating an
> instance of the above struct and passing as an argument to a
> function, the copy constructor is called and the reference
> count is incremented. This is expected. However, when the
> function returns, the destructor is called (on the copy) and
> the reference count lowered. How does the original instance
> know of the updated reference count from the copy?
Actually, this doesn't puzzle me at all! I think I must be tired.
Ignore this paragraph, it doesn't make sense. lol.
More information about the Digitalmars-d-learn
mailing list