Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51980 - in trunk/boost/archive: . detail
From: ramey_at_[hidden]
Date: 2009-03-25 22:01:44


Author: ramey
Date: 2009-03-25 22:01:43 EDT (Wed, 25 Mar 2009)
New Revision: 51980
URL: http://svn.boost.org/trac/boost/changeset/51980

Log:
permit new operator overload
Text files modified:
   trunk/boost/archive/detail/archive_pointer_iserializer.hpp | 2 ++
   trunk/boost/archive/detail/basic_oarchive.hpp | 2 +-
   trunk/boost/archive/detail/iserializer.hpp | 35 +++++++++++++++++++++++++++++++++++
   trunk/boost/archive/polymorphic_iarchive.hpp | 9 +++++++--
   trunk/boost/archive/polymorphic_oarchive.hpp | 9 +++++++--
   5 files changed, 52 insertions(+), 5 deletions(-)

Modified: trunk/boost/archive/detail/archive_pointer_iserializer.hpp
==============================================================================
--- trunk/boost/archive/detail/archive_pointer_iserializer.hpp (original)
+++ trunk/boost/archive/detail/archive_pointer_iserializer.hpp 2009-03-25 22:01:43 EDT (Wed, 25 Mar 2009)
@@ -35,6 +35,8 @@
 namespace archive {
 namespace detail {
 
+class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iarchive;
+
 template<class Archive>
 class archive_pointer_iserializer :
     public basic_pointer_iserializer {

Modified: trunk/boost/archive/detail/basic_oarchive.hpp
==============================================================================
--- trunk/boost/archive/detail/basic_oarchive.hpp (original)
+++ trunk/boost/archive/detail/basic_oarchive.hpp 2009-03-25 22:01:43 EDT (Wed, 25 Mar 2009)
@@ -36,7 +36,7 @@
 namespace archive {
 namespace detail {
 
-class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oarchive_impl;
+class basic_oarchive_impl;
 class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer;
 class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer;
 //////////////////////////////////////////////////////////////////////

Modified: trunk/boost/archive/detail/iserializer.hpp
==============================================================================
--- trunk/boost/archive/detail/iserializer.hpp (original)
+++ trunk/boost/archive/detail/iserializer.hpp 2009-03-25 22:01:43 EDT (Wed, 25 Mar 2009)
@@ -46,6 +46,7 @@
 #include <boost/type_traits/remove_extent.hpp>
 #include <boost/serialization/assume_abstract.hpp>
 #include <boost/type_traits/is_polymorphic.hpp>
+#include <boost/type_traits/has_new_operator.hpp>
 
 #include <boost/mpl/eval_if.hpp>
 #include <boost/mpl/if.hpp>
@@ -192,6 +193,7 @@
 // }
 //}
 
+#if 0
 // note: this should really be a member of the load_ptr function
 // below but some compilers still complain about this.
 template<class T>
@@ -225,6 +227,39 @@
         }
     #endif
 };
+#endif
+
+template<class T>
+struct heap_allocator
+{
+ // usage of member operator new only seems to work on these compilers
+ #if defined(__GNUC__) || defined(BOOST_MSVC) && (BOOST_MSVC > 1300)
+ struct has_new_operator {
+ static T* invoke() {
+ return static_cast<T *>((T::operator new)(sizeof(T)));
+ }
+ };
+ struct doesnt_have_new_operator {
+ static T* invoke() {
+ return static_cast<T *>(operator new(sizeof(T)));
+ }
+ };
+ static T * invoke() {
+ typedef BOOST_DEDUCED_TYPENAME
+ mpl::eval_if<
+ boost::has_new_operator<T>,
+ mpl::identity<has_new_operator >,
+ mpl::identity<doesnt_have_new_operator >
+ >::type typex;
+ return typex::invoke();
+ }
+ #else
+ // This doesn't handle operator new overload for class T
+ static T * invoke(){
+ return static_cast<T *>(operator new(sizeof(T)));
+ }
+ #endif
+};
 
 // due to Martin Ecker
 template <typename T>

Modified: trunk/boost/archive/polymorphic_iarchive.hpp
==============================================================================
--- trunk/boost/archive/polymorphic_iarchive.hpp (original)
+++ trunk/boost/archive/polymorphic_iarchive.hpp 2009-03-25 22:01:43 EDT (Wed, 25 Mar 2009)
@@ -35,6 +35,9 @@
 #include <boost/serialization/nvp.hpp>
 #include <boost/archive/detail/register_archive.hpp>
 
+#include <boost/archive/detail/decl.hpp>
+#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
+
 // determine if its necessary to handle (u)int64_t specifically
 // i.e. that its not a synonym for (unsigned) long
 // if there is no 64 bit int or if its the same as a long
@@ -63,8 +66,8 @@
 } // namespace serialization
 namespace archive {
 namespace detail {
- class basic_iarchive;
- class basic_iserializer;
+ class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iarchive;
+ class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iarchive;
 }
 
 class polymorphic_iarchive;
@@ -189,4 +192,6 @@
 // required by export
 BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::polymorphic_iarchive)
 
+#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
+
 #endif // BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_HPP

Modified: trunk/boost/archive/polymorphic_oarchive.hpp
==============================================================================
--- trunk/boost/archive/polymorphic_oarchive.hpp (original)
+++ trunk/boost/archive/polymorphic_oarchive.hpp 2009-03-25 22:01:43 EDT (Wed, 25 Mar 2009)
@@ -34,6 +34,9 @@
 #include <boost/serialization/nvp.hpp>
 #include <boost/archive/detail/register_archive.hpp>
 
+#include <boost/archive/detail/decl.hpp>
+#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
+
 // determine if its necessary to handle (u)int64_t specifically
 // i.e. that its not a synonym for (unsigned) long
 // if there is no 64 bit int or if its the same as a long
@@ -62,8 +65,8 @@
 } // namespace serialization
 namespace archive {
 namespace detail {
- class basic_oarchive;
- class basic_oserializer;
+ class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oarchive;
+ class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer;
 }
 
 class polymorphic_oarchive;
@@ -166,4 +169,6 @@
 // required by export
 BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::polymorphic_oarchive)
 
+#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
+
 #endif // BOOST_ARCHIVE_POLYMORPHIC_OARCHIVE_HPP


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