Boost logo

Boost-Commit :

From: d.frey_at_[hidden]
Date: 2008-04-23 15:32:44


Author: daniel_frey
Date: 2008-04-23 15:32:44 EDT (Wed, 23 Apr 2008)
New Revision: 44744
URL: http://svn.boost.org/trac/boost/changeset/44744

Log:
Remove dynamic_cast in init_internal_shared_once()
Text files modified:
   trunk/boost/enable_shared_from_this.hpp | 5 +----
   1 files changed, 1 insertions(+), 4 deletions(-)

Modified: trunk/boost/enable_shared_from_this.hpp
==============================================================================
--- trunk/boost/enable_shared_from_this.hpp (original)
+++ trunk/boost/enable_shared_from_this.hpp 2008-04-23 15:32:44 EDT (Wed, 23 Apr 2008)
@@ -23,14 +23,11 @@
 
 template<class T> class enable_shared_from_this
 {
-// dynamic cast to template type doesn't work in constructor, so we have
-// to use lazy initialization
     void init_internal_shared_once() const
     {
         if( !owned() && _internal_shared_count.empty() )
         {
- T * p = dynamic_cast<T *>(const_cast<enable_shared_from_this*>(this));
- detail::shared_count( p, detail::sp_deleter_wrapper() ).swap(_internal_shared_count);
+ detail::shared_count( (void*)0, detail::sp_deleter_wrapper() ).swap(_internal_shared_count);
             _internal_weak_count = _internal_shared_count;
         }
     }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk