Hi there.
Has any of you found a generic method of making boost::any serializable? The net doesn't provide anything more than a couple of unfinished ideas, as far as I have searched.
Exampla code:
Of course, one could modify boost::any. That's not my first option, to be honest.Code:#include <boost/any.hpp> #include <boost/config.hpp> #include <boost/archive/xml_iarchive.hpp> #include <boost/archive/xml_oarchive.hpp> int main() { boost::any a; a = ...[insert some value here]; std::ofstream ofs("C:\\fiel.xml"); boost::archive::xml_oarchive oa(ofs); oa << BOOST_SERIALIZATION_NVP(a); return 0; }
Any ideas, thoughts?




Reply With Quote