
29 Mar
2006
29 Mar
'06
2:53 p.m.
Paul Mensonides wrote:
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Larry Evans
Or maybe I'm misunderstanding your definition of "safe"?
One way that it is safer is in sequence points, e.g.
f( shared_ptr<X>(new X(1, 2, 3)), shared_ptr<Y>(new Y(1, 2, 3)) );
f( make_shared_ptr<X>(1, 2, 3), make_shared_ptr<Y>(1, 2, 3) );
The latter is safe, whereas the former is not.
Another great example of exception-unsafe code is std::map<std::string,boost::shared_ptr<T>> m; m["foo"] = boost::shared_ptr<T>( new T ); -Thorsten