Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60274 - trunk/libs/serialization/src
From: ramey_at_[hidden]
Date: 2010-03-06 21:46:14


Author: ramey
Date: 2010-03-06 21:46:13 EST (Sat, 06 Mar 2010)
New Revision: 60274
URL: http://svn.boost.org/trac/boost/changeset/60274

Log:
fix to permit shared_ptr from this to work
Text files modified:
   trunk/libs/serialization/src/shared_ptr_helper.cpp | 24 ++++++++++++++++++------
   1 files changed, 18 insertions(+), 6 deletions(-)

Modified: trunk/libs/serialization/src/shared_ptr_helper.cpp
==============================================================================
--- trunk/libs/serialization/src/shared_ptr_helper.cpp (original)
+++ trunk/libs/serialization/src/shared_ptr_helper.cpp 2010-03-06 21:46:13 EST (Sat, 06 Mar 2010)
@@ -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 @@
     collection_type::iterator i = m_pointers->find(sp);
 
     if(i == m_pointers->end()){
- std::pair<collection_type::iterator, bool> result;
- shared_ptr<const void> sp(const_cast<void * >(od), void_deleter(true_type));
- result = m_pointers->insert(sp);
- assert(result.second);
- i = result.first;
+ shared_ptr<void> np;
+ return np;
     }
     od = void_upcast(
         *true_type,
@@ -92,6 +89,21 @@
     );
 }
 
+BOOST_ARCHIVE_DECL(void)
+shared_ptr_helper::append(const boost::shared_ptr<const void> &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<collection_type::iterator, bool> 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<const void> & t){


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