Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-11-25 13:06:22


From: "Jim Grandy" <jgrandy_at_[hidden]>
To: <boost-request_at_[hidden]>; "Peter Dimov" <pdimov_at_[hidden]>

> One thing missing from intrusive_ptr as implemented in 1.29 is the ability
> to avoid the add_ref at construction time.
>
> There are a number of APIs using refcounted opaque types (Apple in
> particular is fond of them) in which a function call will "pre-acquire" a
> reference for the caller. In many OS X APIs, this is designated by use of
> the term "Copy" or "Create" instead of "Get". If you think about it,
adding
> a ref before returning is necessary for flat C APIs to avoid thread
> synchronization problems.

[...]

> This would allow one to use this style of code:
>
> intrusive_ptr<OpaqueRefCountedString> s =
> dont_addref(CopyMenuTitle(m));

intrusive_ptr<OpaqueRefCountedString> s = CopyMenuTitle(m);
s->Release(); // or however it's spelled

?

BTW, there is no boost-request list, I think. :-)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk