boost c++ serialize/deserialize
Can someone give me an example of serialization/deseralization using the Boost library? I am working in c++/ubuntu 9.1
I have the class
class x
{
public:
x();
std::string name;
std::string surname;
};
How can I create XML <1.0...> id: <name>..<surname>
using boost serialization? Or is there another开发者_Python百科 way to do it?
boost serialization will build its own XML schema which is not modifiable. Serialization is for serialization not reading/writing random XML.
boost is overkill for such a trivial example... I mean, all you need is
friend std::ostream& (std::ostream& str, x const & cData)
{
return str << "<...><name>" << cData.name << "</name><surname>" << cData.surname << "</surname></...>";
}
精彩评论