Boost logo

Boost Users :

From: Tom Matelich (tmatelich_at_[hidden])
Date: 2003-04-30 12:21:58


> From: Hossein Haeri [mailto:powerprogman_at_[hidden]]
> Sent: Wednesday, April 30, 2003 8:29 AM
>
> I want to know what the following means:
>
> int a = 5;
> const boost::shared_ptr<int> sp(&a);
>

I assume you know this, but this code is in error. When the last shared_ptr
referencing &a goes away, it will try to delete a, which is illegal. There
is a workaround defined at
http://www.boost.org/libs/smart_ptr/sp_techniques.html#static , though.

-----------------------------------------------------------------------
DISCLAIMER: Information contained in this message and/or
attachment(s) may contain confidential information of Zetec, Inc.
If you have received this transmission in error, please notify
the sender by return email.
-----------------------------------------------------------------------


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