
Indeed, and my initial workaround was to force that through: It may be related to: https://svn.boost.org/trac10/ticket/13108 (is_default_constructible support.) Time to start muddying the waters. (Note: the binary archives were taken from the latest serialization 'test' code area.) Some test code: #include <boost/serialization/string.hpp> #include <boost/serialization/optional.hpp> #include <fstream> #if 1 #include "boost/portable_binary_iarchive.hpp" #include "boost/portable_binary_oarchive.hpp" typedef portable_binary_oarchive oarchive_type; typedef portable_binary_iarchive iarchive_type; std::ios_base::openmode flags = std::ios::binary; #else #include <boost/archive/text_iarchive.hpp> #include <boost/archive/text_oarchive.hpp> typedef boost::archive::text_oarchive oarchive_type; typedef boost::archive::text_iarchive iarchive_type; std::ios_base::openmode flags = std::ios_base::openmode(); #endif #if (BOOST_VERSION >= 106400) && (__GNUC__*100 + __GNUC_MINOR__ == 406) namespace boost { namespace serialization { namespace detail { template <> struct is_default_constructible<std::string> : boost::true_type {}; }}} #endif int main(int argc, char *argv[]) { (void)argc; (void)argv; { std::ofstream ofs("/tmp/tmp.bin", std::ios::out | flags); boost::optional<std::string> s = std::string("hello"); oarchive_type oa(ofs); oa << s; } { std::ifstream ifs("/tmp/tmp.bin", std::ios::in | flags); boost::optional<std::string> s; iarchive_type ia(ifs); // # CRASH for binary # ia >> s; } } To work around the static_assertion, I tried adding the (serialization) specialization for is_default_constructible<std::string>. This then gets everything to compile, and the text_archive version doesn't have any problems. However, the binary_archive version crashes when trying to de-serialize. ( basic_binary_iprimitive.ipp(107): s.resize(l); ) I was concerned that the specialization has activated something undesirable, hence my question about the correct way forward... -- Sent from: http://boost.2283326.n4.nabble.com/Boost-Users-f2553780.html