Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51991 - trunk/boost/archive/detail
From: ramey_at_[hidden]
Date: 2009-03-26 14:49:18


Author: ramey
Date: 2009-03-26 14:49:18 EDT (Thu, 26 Mar 2009)
New Revision: 51991
URL: http://svn.boost.org/trac/boost/changeset/51991

Log:
adjusted usage of has_new_operator
Text files modified:
   trunk/boost/archive/detail/iserializer.hpp | 47 +++++----------------------------------
   1 files changed, 7 insertions(+), 40 deletions(-)

Modified: trunk/boost/archive/detail/iserializer.hpp
==============================================================================
--- trunk/boost/archive/detail/iserializer.hpp (original)
+++ trunk/boost/archive/detail/iserializer.hpp 2009-03-26 14:49:18 EDT (Thu, 26 Mar 2009)
@@ -193,47 +193,19 @@
 // }
 //}
 
-#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>
 struct heap_allocator
 {
- #if 0
- // note: this fails on msvc 7.0 and gcc 3.2
- template <class U, U x> struct test;
- typedef char* yes;
- typedef int* no;
- template <class U>
- yes has_op_new(U*, test<void* (*)(std::size_t), &U::operator new>* = 0);
- no has_op_new(...);
-
- template<class U>
- T * new_operator(U);
-
- T * new_operator(yes){
- return (T::operator new)(sizeof(T));
- }
- T * new_operator(no){
- return static_cast<T *>(operator new(sizeof(T)));
- }
- static T * invoke(){
- return new_operator(has_op_new(static_cast<T *>(NULL)));
- }
- #else
- // while this doesn't handle operator new overload for class T
+ // boost::has_new_operator<T> doesn't work on these compilers
+ #if defined(__BORLANDC__) \
+ || defined(__IBMCPP__) \
+ || defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) \
+ || defined(__SUNPRO_CC) && (__SUBPRO_CC < 0x590)
+ // This doesn't handle operator new overload for class T
         static T * invoke(){
             return static_cast<T *>(operator new(sizeof(T)));
         }
- #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)
+ #else
         struct has_new_operator {
             static T* invoke() {
                 return static_cast<T *>((T::operator new)(sizeof(T)));
@@ -253,11 +225,6 @@
>::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
 };
 


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