From 9b7f80f25cf69cde11de6eeda8093f969bcc6247 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Tue, 23 Oct 2018 22:51:44 -0400 Subject: [PATCH] GenericValue stores a T. So, it potentially has to be aligned. We check this requirement and call Eigen's aligning operator if so. --- gtsam/base/GenericValue.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gtsam/base/GenericValue.h b/gtsam/base/GenericValue.h index f98b3669e..1b59b6c1d 100644 --- a/gtsam/base/GenericValue.h +++ b/gtsam/base/GenericValue.h @@ -187,7 +187,14 @@ public: ar & boost::serialization::make_nvp("GenericValue", boost::serialization::base_object(*this)); ar & boost::serialization::make_nvp("value", value_); - } + + // Alignment, see https://eigen.tuxfamily.org/dox/group__TopicStructHavingEigenMembers.html + enum { NeedsToAlign = (sizeof(T) % 16) == 0 }; + + public: + + EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) + } /// use this macro instead of BOOST_CLASS_EXPORT for GenericValues #define GTSAM_VALUE_EXPORT(Type) BOOST_CLASS_EXPORT(gtsam::GenericValue)