diff --git a/include/boost/weak_ptr.hpp b/include/boost/weak_ptr.hpp index 33d762d..356ab60 100644 --- a/include/boost/weak_ptr.hpp +++ b/include/boost/weak_ptr.hpp @@ -51,29 +51,6 @@ public: { } - template - weak_ptr(weak_ptr const & r, detail::static_cast_tag): px(static_cast(r.px)), pn(r.pn) - { - } - - template - weak_ptr(weak_ptr const & r, detail::dynamic_cast_tag): px(dynamic_cast(r.px)), pn(r.pn) - { - if (px == 0) // need to allocate new counter -- the cast failed - { - pn = detail::weak_count(); - } - } - - template - weak_ptr(weak_ptr const & r, detail::polymorphic_cast_tag): px(dynamic_cast(r.px)), pn(r.pn) - { - if (px == 0) - { - throw std::bad_cast(); - } - } - template weak_ptr & operator=(weak_ptr const & r) // never throws { @@ -187,27 +164,6 @@ template shared_ptr make_shared(weak_ptr const & r) // never thro } } -template weak_ptr shared_static_cast(weak_ptr const & r) -{ - return weak_ptr(r, detail::static_cast_tag()); -} - -template weak_ptr shared_dynamic_cast(weak_ptr const & r) -{ - return weak_ptr(r, detail::dynamic_cast_tag()); -} - -template weak_ptr shared_polymorphic_cast(weak_ptr const & r) -{ - return weak_ptr(r, detail::polymorphic_cast_tag()); -} - -template weak_ptr shared_polymorphic_downcast(weak_ptr const & r) -{ - BOOST_ASSERT(dynamic_cast(r.get()) == r.get()); - return shared_static_cast(r); -} - } // namespace boost #ifdef BOOST_MSVC diff --git a/shared_ptr_test.cpp b/shared_ptr_test.cpp index 0e4e86b..7b1b960 100644 --- a/shared_ptr_test.cpp +++ b/shared_ptr_test.cpp @@ -244,7 +244,7 @@ int test_main(int, char * []) test_is_nonzero(boost::make_shared(wp2)); } - weak_ptr wp3 = shared_dynamic_cast(wp2); + weak_ptr wp3 = shared_dynamic_cast(boost::make_shared(wp2)); BOOST_TEST(wp3.use_count() == 1); BOOST_TEST(wp3.get() != 0);