Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-09-26 07:59:22


From: "nobody" <yg-boost-users_at_[hidden]>
> Hi!
>
> There is a intrusive_ptr.cpp in boost 1.28, but I did not find any doc
> for that... exept for in the timing .
>
> Why?

Because I haven't written the doc yet. :-)

> Guessing from the name, intrusive_ptr requires the pointed-to object to
> store the reference count or something like that, doesn't it?

True.

> And what does anybody think of typedefing std::auto_ptr to
> boost::single_ptr?

What would the purpose, assuming that you can typedef a template?

> Finally I have a suggestion for a new type of smart pointer one could
> call "notifying_ptr": Sometimes all weak pointing objects need to be
> notified when the object pointed to is destroyed: e.g. in a game some
> units are set to attack some building, so they store a weak_ptr to the
> building, but when that building is destroyed, it would be easier to
> implement and faster performing, if the units got a message so they can
> look for a new target, instead of having strong pointers, marking the
> building as dead, and polling for that state every time the unit does
> something. It could be quite some time until all units have realized
> that the building is gone and it really can be released from memory.

Yes, this might be useful. It requires the ability to enumerate all pointers
to a given object, which the current implementation doesn't provide. I'm not
yet sure whether this should be "left to the reader" or be a part of the
library.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net