14 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
16 #include <boost/config.hpp>
18 #include <boost/archive/detail/basic_iarchive.hpp>
19 #include <boost/move/utility_core.hpp>
21 #include <boost/serialization/item_version_type.hpp>
22 #include <boost/serialization/split_free.hpp>
23 #include <boost/serialization/level.hpp>
24 #include <boost/serialization/nvp.hpp>
25 #include <boost/serialization/version.hpp>
26 #include <boost/type_traits/is_pointer.hpp>
27 #include <boost/serialization/detail/stack_constructor.hpp>
28 #include <boost/serialization/detail/is_default_constructible.hpp>
50 #if __GNUC__ >= 7 && __cplusplus >= 201703L
51 namespace boost {
namespace serialization {
struct U; } }
52 namespace std {
template<>
struct is_trivially_default_constructible<
boost::
serialization::U> : std::false_type {}; }
65 #if BOOST_VERSION < 108400
69 namespace serialization {
71 template <
class Archive,
class T>
72 void save(Archive& ar,
const std::optional<T>&
t,
const unsigned int
78 const bool tflag =
t.has_value();
79 ar << boost::serialization::make_nvp(
"initialized", tflag);
81 ar << boost::serialization::make_nvp(
"value", *
t);
85 template <
class Archive,
class T>
86 void load(Archive& ar, std::optional<T>&
t,
const unsigned int ) {
88 ar >> boost::serialization::make_nvp(
"initialized", tflag);
98 ar >> boost::serialization::make_nvp(
"value", *
t);
101 template <
class Archive,
class T>
102 void serialize(Archive& ar, std::optional<T>&
t,
const unsigned int version) {
103 boost::serialization::split_free(ar,
t,
version);
108 #endif // BOOST_VERSION < 108400
109 #endif // GTSAM_ENABLE_BOOST_SERIALIZATION