I have a variant that has some alternatives which do not have public default constructors. They do have private default constructors though, and are friended to boost::serialization::access. However, the variant serializer in boost/serialization/std_variant.hpp can't construct these types.
I wonder if the variant serializaer should, instead of this:
Do something along the lines of
alignas(type) unsigned char value_storage[sizeof(type)];
type *value_ptr = reinterpret_cast<type *>(value_storage);
access::construct(value_ptr);
std::experimental::scope_exit cleanup([&]() { access::destroy(value_ptr) };
ar >> BOOST_SERIALIZATION_NVP(*value_ptr);
v = std::move(*value_ptr);
If this sounds right I can send a PR. thoughts?
I have a variant that has some alternatives which do not have public default constructors. They do have private default constructors though, and are friended to
boost::serialization::access. However, the variant serializer inboost/serialization/std_variant.hppcan't construct these types.I wonder if the variant serializaer should, instead of this:
serialization/include/boost/serialization/std_variant.hpp
Line 125 in 8a8c628
Do something along the lines of
If this sounds right I can send a PR. thoughts?