Vladimir Prus wrote:
Robert Ramey wrote:
Do we have serialization support for boost::any? If not, how is it possible to serialize boost::any?
Good question. Robert, is it possible to place BOOST_CLASS_EXPORT inside class definition, so that I can write something like that:
class any_base {}; template<class T> class any_value_holder : public any_base { ....... BOOST_CLASS_EXPORT(any_value_holder); };
and have BOOST_CLASS_EXPORT run for each instantiation of any_value_holder?
This would tie the GUID "any_value_holder" to multiple types any_value_holder<T> so it wouldn't be unique any more.
So, basically we can't make "any" serializable?
I doubt its hard to make "any" serializable. Its the automatic export of any<T> (or whatever it is) that's the difficulty. If one is willing to add BOOST_CLASS_EXPORT_GUID(any<X>, "any_X") for each any<X> used in one's application there would be no problem. The issue isn't the serialization of boost::any per se, but rather how to generate a character name from a type. As I write thsi, I was going to mention that shared_ptr<T> has the same problem --- But, it doesn't now I have to think about if there is any problem at all or what. Robert Ramey