13 #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 {}; }
62 namespace serialization {
64 template <
class Archive,
class T>
65 void save(Archive& ar,
const std::optional<T>&
t,
const unsigned int 71 const bool tflag = t.has_value();
72 ar << boost::serialization::make_nvp(
"initialized", tflag);
74 ar << boost::serialization::make_nvp(
"value", *t);
78 template <
class Archive,
class T>
79 void load(Archive& ar, std::optional<T>& t,
const unsigned int ) {
81 ar >> boost::serialization::make_nvp(
"initialized", tflag);
91 ar >> boost::serialization::make_nvp(
"value", *t);
94 template <
class Archive,
class T>
95 void serialize(Archive& ar, std::optional<T>& t,
const unsigned int version) {
96 boost::serialization::split_free(ar, t, version);
std::string serialize(const T &input)
serializes to a string