diff DEPENDENCIES/generic/include/boost/serialization/weak_ptr.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
line wrap: on
line diff
--- a/DEPENDENCIES/generic/include/boost/serialization/weak_ptr.hpp	Fri Sep 04 12:01:02 2015 +0100
+++ b/DEPENDENCIES/generic/include/boost/serialization/weak_ptr.hpp	Mon Sep 07 11:12:49 2015 +0100
@@ -2,12 +2,12 @@
 #define BOOST_SERIALIZATION_WEAK_PTR_HPP
 
 // MS compatible compilers support #pragma once
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#if defined(_MSC_VER)
 # pragma once
 #endif
 
 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
-// shared_ptr.hpp: serialization for boost shared pointer
+// weak_ptr.hpp: serialization for boost weak pointer
 
 // (C) Copyright 2004 Robert Ramey and Martin Ecker
 // Use, modification and distribution is subject to the Boost Software
@@ -55,4 +55,45 @@
 } // namespace serialization
 } // namespace boost
 
+#ifndef BOOST_NO_CXX11_SMART_PTR
+#include <memory>
+
+namespace boost {
+namespace serialization{
+
+template<class Archive, class T>
+inline void save(
+    Archive & ar,
+    const std::weak_ptr< T > &t,
+    const unsigned int /* file_version */
+){
+    const std::shared_ptr< T > sp = t.lock();
+    ar << boost::serialization::make_nvp("weak_ptr", sp);
+}
+
+template<class Archive, class T>
+inline void load(
+    Archive & ar,
+    std::weak_ptr< T > &t,
+    const unsigned int /* file_version */
+){
+    std::shared_ptr< T > sp;
+    ar >> boost::serialization::make_nvp("weak_ptr", sp);
+    t = sp;
+}
+
+template<class Archive, class T>
+inline void serialize(
+    Archive & ar,
+    std::weak_ptr< T > &t,
+    const unsigned int file_version
+){
+    boost::serialization::split_free(ar, t, file_version);
+}
+
+} // namespace serialization
+} // namespace boost
+
+#endif // BOOST_NO_CXX11_SMART_PTR
+
 #endif // BOOST_SERIALIZATION_WEAK_PTR_HPP