C++ Cereal XML-Archive not working with stringstream

133 Views Asked by At

I am trying to get cereal-serialization to work. But somehow it does not work with the XML-Archive in combination with a stringstream.

Here is my example:

std::stringstream ss;

cereal::XMLOutputArchive oarchive(ss);
oarchive(cereal::make_nvp("data", mydata));

ss.str(); //empty

The wierd thing is, that the JSON-Archive is working totally fine, and if a put the std::cout into the XML-Archive, it prints out my serialization. Only the stringstream stays empty.

I tried to find a solution in the documentation but did not find anything about it. Did someone else have a similar problem?

Thanks in advance!

0

There are 0 best solutions below