Re: [Boost-users] [shared_ptr] Is there an interface to set the ptr a shared_ptr holds

Hello Scott,
Thanks.
It seems to be one of the simplest way to get to my needs
to declare another companion auto_free_helper.
It's better than none, if not the best.
I'm using this technique for stream:
std::ofstream outstream(strPath);
boost::shared_ptrstd::ofstream os_auto_closer(&outstream,
boost::bind(&std::ofstream::close, _1));
B/Rgds
Max
----- Original Message -----
From: Scott McMurray
I think the following is fine: A *pa_ = 0; setA(pa_); boost::shared_ptr<A> pa(pa_, boost::bind(&A::close, _1)); Since the shared_ptr constructor will call the deleter if its internal allocation fails. ~ Scott _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users ------------------------------------------------------------------- 新浪空间——与朋友开心分享网络新生活!(http://space.sina.com.cn/ )
participants (3)
-
Max
-
Max
-
Scott McMurray