diff --git a/src/shared_ptr_helper.cpp b/src/shared_ptr_helper.cpp index d4e10cdb..ec15e2e2 100644 --- a/src/shared_ptr_helper.cpp +++ b/src/shared_ptr_helper.cpp @@ -4,7 +4,7 @@ #endif /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 -// shared_ptr_helper.hpp: serialization for boost shared pointer +// shared_ptr_helper.hpp: serialization for boost shared pointern // (C) Copyright 2004-2009 Robert Ramey, Martin Ecker and Takatoshi Kondo // Use, modification and distribution is subject to the Boost Software @@ -66,11 +66,8 @@ shared_ptr_helper::get_od( collection_type::iterator i = m_pointers->find(sp); if(i == m_pointers->end()){ - std::pair result; - shared_ptr sp(const_cast(od), void_deleter(true_type)); - result = m_pointers->insert(sp); - assert(result.second); - i = result.first; + shared_ptr np; + return np; } od = void_upcast( *true_type, @@ -92,6 +89,21 @@ shared_ptr_helper::get_od( ); } +BOOST_ARCHIVE_DECL(void) +shared_ptr_helper::append(const boost::shared_ptr &sp){ + // make tracking array if necessary + if(NULL == m_pointers) + m_pointers = new collection_type; + + collection_type::iterator i = m_pointers->find(sp); + + if(i == m_pointers->end()){ + std::pair result; + result = m_pointers->insert(sp); + assert(result.second); + } +} + // #ifdef BOOST_SERIALIZATION_SHARED_PTR_132_HPP BOOST_ARCHIVE_DECL(void) shared_ptr_helper::append(const boost_132::shared_ptr & t){