11 Oct 14:31
Re: [shared_ptr] Ticket 2126 status?
Peter Dimov <pdimov <at> pdimov.com>
2008-10-11 12:31:22 GMT
2008-10-11 12:31:22 GMT
Andrey Semashev: > Is the ticket 2126: > > http://svn.boost.org/trac/boost/ticket/2126 > > actually fixed in trunk? The ticket is still open, but my code that uses > enable_shared_from_this and make_shared runs fine on trunk. Interesting. No, I don't believe that trunk is OK. The constructor support just masks the problem. Try for example the following test: #include <boost/shared_ptr.hpp> #include <boost/enable_shared_from_this.hpp> #include <boost/make_shared.hpp> #include <boost/detail/lightweight_test.hpp> struct X: boost::enable_shared_from_this<X> { bool destroyed_; X(): destroyed_( false ) {} ~X() { destroyed_ = true; } }; int main() { boost::shared_ptr<X> px = boost::make_shared<X>(); boost::shared_ptr<X> px2 = px->shared_from_this(); BOOST_TEST( px == px2 ); BOOST_TEST( !( px < px2 ) && !( px2 < px ) ); px.reset(); BOOST_TEST( !px2->destroyed_ ); return boost::report_errors(); } _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
RSS Feed