]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Allow (de)serialization of std_cxx11::unique_ptrs also in C++98 mode.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 11 Aug 2016 15:51:50 +0000 (10:51 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 14 Aug 2016 19:17:13 +0000 (14:17 -0500)
This just requires forwarding to the corresponding functions for the
boost::scoped_ptr class.

include/deal.II/base/std_cxx11/unique_ptr.h

index 5476ec68799f6ef5217e9aa09922c4509f23ad6c..e8d30338db5fc9476d44823e4893820adb6e6bb9 100644 (file)
@@ -1,6 +1,6 @@
 // ---------------------------------------------------------------------
 //
-// Copyright (C) 2015 by the deal.II authors
+// Copyright (C) 2015, 2016 by the deal.II authors
 //
 // This file is part of the deal.II library.
 //
@@ -32,6 +32,8 @@ DEAL_II_NAMESPACE_CLOSE
 #else
 
 #include <boost/scoped_ptr.hpp>
+#include <boost/serialization/scoped_ptr.hpp>
+
 
 DEAL_II_NAMESPACE_OPEN
 namespace std_cxx11
@@ -66,6 +68,31 @@ namespace std_cxx11
     {}
   };
 
+
+  template<class Archive, class T>
+  void save(Archive &ar,
+            const unique_ptr< T > &t,
+            const unsigned int version)
+  {
+    boost::serialization::save (ar, static_cast<boost::scoped_ptr<T>&>(t), version);
+  }
+
+  template<class Archive, class T>
+  void load(Archive &ar,
+            unique_ptr< T > &t,
+            const unsigned int version)
+  {
+    boost::serialization::load (ar, static_cast<boost::scoped_ptr<T>&>(t), version);
+  }
+
+  template<class Archive, class T>
+  void serialize(Archive &ar,
+                 unique_ptr< T > &t,
+                 const unsigned int version)
+  {
+    boost::serialization::serialize (ar, static_cast<boost::scoped_ptr<T>&>(t), version);
+  }
+
 }
 DEAL_II_NAMESPACE_CLOSE
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.