|
Boost Users : |
Subject: Re: [Boost-users] [serialization] Problems with serializing a shared_ptr
From: Stefan Ulbrich (stevie157_at_[hidden])
Date: 2009-11-17 05:43:37
Hi,
thanks a lot for you help. Unfortunately, adding a virtual dummy
function to the base class (the only one I can alter directly in the
library) didn't resolve the problem.
So I don't know (didn't check the beta) if 1.41 will resolve this issue.
I tried to track it down deep into the heap allocation but I don't
have any experience at all with meta-programming and the MPL and gave
up in the end.
I found a quick (and dirty) fix, though, that helps in my case.
Therefor, I wrote a specialization of
boost::archive::details::heap_allocator for the eigen::Matrix<>
classes that uses
code that was reserved for compiler that didn't support the
has_new_operator feature (which is obviously the case).
namespace boost {
namespace archive {
namespace detail {
template<typename Scalar, int Rows, int Cols>
struct heap_allocator<Eigen::Matrix<Scalar, Rows, Cols> > {
typedef Eigen::Matrix<Scalar, Rows, Cols> T;
static T * invoke() {
return static_cast<T *> (operator new(sizeof (T)));
}
};
};
};
};
Best regards,
Stefan
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net