Boost binary_oarchive not working with dynamic buffer
I’m trying to serialize an object using boost serialization. Everything works perfectly if I use a text_archive, I can serialize, deserialize back, and everything is in its place. I tried to serialize with a binary archive, with mixed result. If I use a boost array_sink, connected to a char buffer, everything works smootly. If I change to a dynamically allocated buffer, the serialization fails, and the corresponding vector is left empty.
I found many examples of people using a iostream with back inserter, and nobody had such a problem.
Here is an example that give me the error: