diff --git a/include/boost/archive/detail/iserializer.hpp b/include/boost/archive/detail/iserializer.hpp index 55a183d0..ccbb0171 100644 --- a/include/boost/archive/detail/iserializer.hpp +++ b/include/boost/archive/detail/iserializer.hpp @@ -405,7 +405,11 @@ struct load_non_pointer_type { struct load_standard { template static void invoke(Archive &ar, const T & t){ - void * x = & const_cast(t); + #ifdef BOOST_NO_CXX11_ADDRESSOF + void * x = boost::addressof(const_cast(t)); + #else + void * x = std::addressof(const_cast(t)); + #endif ar.load_object( x, boost::serialization::singleton< diff --git a/include/boost/serialization/nvp.hpp b/include/boost/serialization/nvp.hpp index 4e2297b3..70455375 100644 --- a/include/boost/serialization/nvp.hpp +++ b/include/boost/serialization/nvp.hpp @@ -28,6 +28,12 @@ #include #include +#ifdef BOOST_NO_CXX11_ADDRESSOF +#include +#else +#include // std::addressof +#endif + namespace boost { namespace serialization { @@ -43,7 +49,11 @@ struct nvp : public: explicit nvp(const char * name_, T & t) : // note: added _ to suppress useless gcc warning - std::pair(name_, & t) + #ifdef BOOST_NO_CXX11_ADDRESSOF + std::pair(name_, boost::addressof(t)) + #else + std::pair(name_, std::addressof(t)) + #endif {} const char * name() const { diff --git a/include/boost/serialization/singleton.hpp b/include/boost/serialization/singleton.hpp index 2481c76e..547d7259 100644 --- a/include/boost/serialization/singleton.hpp +++ b/include/boost/serialization/singleton.hpp @@ -87,25 +87,25 @@ namespace serialization { // to avoid dropping these functions which seem to be unreferenced. // This usage is not related to autolinking. -class BOOST_SYMBOL_VISIBLE singleton_module : +class BOOST_SERIALIZATION_DECL singleton_module : public boost::noncopyable { private: - BOOST_DLLEXPORT static bool & get_lock() BOOST_USED; +static bool & get_lock() BOOST_USED; public: - BOOST_DLLEXPORT static void lock(){ + static void lock(){ get_lock() = true; } - BOOST_DLLEXPORT static void unlock(){ + static void unlock(){ get_lock() = false; } - BOOST_DLLEXPORT static bool is_locked(){ + static bool is_locked(){ return get_lock(); } }; template -class singleton : public singleton_module +class BOOST_SERIALIZATION_DECL singleton : public singleton_module { private: static T & m_instance; @@ -133,20 +133,20 @@ private: } public: - BOOST_DLLEXPORT static T & get_mutable_instance(){ + static T & get_mutable_instance(){ BOOST_ASSERT(! is_locked()); return get_instance(); } - BOOST_DLLEXPORT static const T & get_const_instance(){ + static const T & get_const_instance(){ return get_instance(); } - BOOST_DLLEXPORT static bool is_destroyed(){ + static bool is_destroyed(){ return get_is_destroyed(); } - BOOST_DLLEXPORT singleton(){ + singleton(){ get_is_destroyed() = false; } - BOOST_DLLEXPORT ~singleton() { + ~singleton() { get_is_destroyed() = true; } }; diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 08ff979c..c98f8dcc 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -9,6 +9,7 @@ project libs/serialization/test : id serialization_test : requirements /boost/filesystem + : requirements /boost/system ; # import rules for testing conditional on config file variables @@ -133,8 +134,8 @@ test-suite "serialization" : if ! $(BOOST_ARCHIVE_LIST) { test-suite "serialization2" : - [ test-bsl-run-no-lib test_inclusion ] - [ test-bsl-run-no-lib test_inclusion2 ] + [ test-bsl-run test_inclusion ] + [ test-bsl-run test_inclusion2 ] [ test-bsl-run test_dll_exported : : dll_polymorphic_derived2_lib ] [ test-bsl-run test_dll_simple : : dll_a_lib ] [ compile test_dll_plugin.cpp ] diff --git a/test/test_dll_exported.cpp b/test/test_dll_exported.cpp index bd20268e..540fd498 100644 --- a/test/test_dll_exported.cpp +++ b/test/test_dll_exported.cpp @@ -85,9 +85,9 @@ void save_exported(const char *testfile) oa << BOOST_SERIALIZATION_NVP(rb2); oa << BOOST_SERIALIZATION_NVP(rd21); - delete rb1; - delete rb2; delete rd21; + delete rb2; + delete rb1; } // save exported polymorphic class @@ -129,9 +129,9 @@ void load_exported(const char *testfile) ::type::get_const_instance().get_derived_extended_type_info(*rd21), "restored pointer d2 not of correct type" ); - delete rb1; - delete rb2; delete rd21; + delete rb2; + delete rb1; } int