blitzpp / blitz

Blitz++ Multi-Dimensional Array Library for C++
https://github.com/blitzpp/blitz/wiki
Other
406 stars 84 forks source link

fix for boost serialization #30

Closed efp closed 6 years ago

efp commented 6 years ago

The boost serialization functionality was broken with newer versions of boost. This patch fixes it:

diff -Naur blitz-0.10-orig/blitz/memblock.h blitz-0.10-patched/blitz/memblock.h
--- blitz-0.10-orig/blitz/memblock.h    2012-06-26 15:25:15.000000000 -0700
+++ blitz-0.10-patched/blitz/memblock.h 2017-08-08 11:16:39.763291400 -0700
@@ -41,9 +41,16 @@
 #include <boost/serialization/array.hpp>
 #include <boost/serialization/collection_size_type.hpp>
 #include <boost/serialization/nvp.hpp>
+#include <boost/version.hpp>
+
+#  if BOOST_VERSION >= 106000
+#    include <boost/serialization/array_wrapper.hpp>
+#    include <boost/archive/detail/iserializer.hpp>
+#  endif
 #endif
 #include <stddef.h>     // diffType

+
 BZ_NAMESPACE(blitz)

 enum preexistingMemoryPolicy { 
@@ -79,6 +86,12 @@
     typedef P_type T_type;

 protected:
+#ifdef BZ_HAVE_BOOST_SERIALIZATION
+#  if BOOST_VERSION >= 106000
+    friend class boost::serialization::access ;
+    template<class T> friend class boost::archive::detail::heap_allocation;
+#  endif
+#endif
     explicit MemoryBlock(sizeType items)
     {
       // pad the length to vecWidth, if not already done
citibeth commented 6 years ago

Can you submit this as a pull request?

slayoo commented 6 years ago

Closing as we have now the PR: https://github.com/blitzpp/blitz/pull/34 Thank you!