|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58296 - trunk/boost/serialization
From: ramey_at_[hidden]
Date: 2009-12-11 14:32:30
Author: ramey
Date: 2009-12-11 14:32:30 EST (Fri, 11 Dec 2009)
New Revision: 58296
URL: http://svn.boost.org/trac/boost/changeset/58296
Log:
Call dtor through serialization::access in order to permit private dtors/ctors
Text files modified:
trunk/boost/serialization/extended_type_info.hpp | 9 ++-------
trunk/boost/serialization/extended_type_info_no_rtti.hpp | 8 +++++++-
trunk/boost/serialization/extended_type_info_typeid.hpp | 17 ++++++++---------
trunk/boost/serialization/weak_ptr.hpp | 4 ++--
4 files changed, 19 insertions(+), 19 deletions(-)
Modified: trunk/boost/serialization/extended_type_info.hpp
==============================================================================
--- trunk/boost/serialization/extended_type_info.hpp (original)
+++ trunk/boost/serialization/extended_type_info.hpp 2009-12-11 14:32:30 EST (Fri, 11 Dec 2009)
@@ -82,13 +82,8 @@
}
static const extended_type_info * find(const char *key);
// for plugins
- virtual void * construct(unsigned int /*count*/ = 0, ...) const {
- assert(false); // must be implemented if used
- return NULL;
- };
- virtual void destroy(void const * const /*p*/) const {
- assert(false); // must be implemented if used
- }
+ virtual void * construct(unsigned int /*count*/ = 0, ...) const = 0;
+ virtual void destroy(void const * const /*p*/) const = 0;
};
template<class T>
Modified: trunk/boost/serialization/extended_type_info_no_rtti.hpp
==============================================================================
--- trunk/boost/serialization/extended_type_info_no_rtti.hpp (original)
+++ trunk/boost/serialization/extended_type_info_no_rtti.hpp 2009-12-11 14:32:30 EST (Fri, 11 Dec 2009)
@@ -31,6 +31,9 @@
#include <boost/serialization/factory.hpp>
#include <boost/serialization/throw_exception.hpp>
+// hijack serialization access
+#include <boost/serialization/access.hpp>
+
#include <boost/config/abi_prefix.hpp> // must be the last header
#ifdef BOOST_MSVC
# pragma warning(push)
@@ -141,7 +144,10 @@
}
}
virtual void destroy(void const * const p) const{
- delete static_cast<T const *>(p) ;
+ boost::serialization::access::destroy(
+ static_cast<T const * const>(p)
+ );
+ //delete static_cast<T const * const>(p) ;
}
};
Modified: trunk/boost/serialization/extended_type_info_typeid.hpp
==============================================================================
--- trunk/boost/serialization/extended_type_info_typeid.hpp (original)
+++ trunk/boost/serialization/extended_type_info_typeid.hpp 2009-12-11 14:32:30 EST (Fri, 11 Dec 2009)
@@ -32,6 +32,9 @@
#include <boost/serialization/extended_type_info.hpp>
#include <boost/serialization/factory.hpp>
+// hijack serialization access
+#include <boost/serialization/access.hpp>
+
#include <boost/mpl/if.hpp>
#include <boost/config/abi_prefix.hpp> // must be the last header
@@ -125,15 +128,11 @@
return NULL;
}
}
- virtual void destroy(void const * const /* p */) const {
- // the only current usage of extended type info is in the
- // serialization library. The statement below requires
- // that destructor of type T be public and this creates
- // a problem for some users. So, for now, comment this
- // out
- //delete static_cast<T const *>(p);
- // and trap any attempt to invoke this function
- assert(false);
+ virtual void destroy(void const * const p) const {
+ boost::serialization::access::destroy(
+ static_cast<T const * const>(p)
+ );
+ //delete static_cast<T const * const>(p);
}
};
Modified: trunk/boost/serialization/weak_ptr.hpp
==============================================================================
--- trunk/boost/serialization/weak_ptr.hpp (original)
+++ trunk/boost/serialization/weak_ptr.hpp 2009-12-11 14:32:30 EST (Fri, 11 Dec 2009)
@@ -29,7 +29,7 @@
const unsigned int /* file_version */
){
const boost::shared_ptr<T> sp = t.lock();
- ar << boost::serialization::make_nvp("shared_ptr", sp);
+ ar << boost::serialization::make_nvp("weak_ptr", sp);
}
template<class Archive, class T>
@@ -39,7 +39,7 @@
const unsigned int /* file_version */
){
boost::shared_ptr<T> sp;
- ar >> boost::serialization::make_nvp("shared_ptr", sp);
+ ar >> boost::serialization::make_nvp("weak_ptr", sp);
t = sp;
}
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