Boost serialization doc's assert that the way to serialize/deserialize items is using a binary/text archive with a stream on the underlying structure. This works fine if I wan't to use the serialized data as an std::string, but my intention is to convert it directly to a char* buffer. How can I achieve this without creating a temporary string?
Solved! For the ones that wanted a example:
char buffer[4096];
boost::iostreams::basic_array_sink<char> sr(buffer, buffer_size);
boost::iostreams::stream< boost::iostreams::basic_array_sink<char> > source(sr);
boost::archive::binary_oarchive oa(source);
oa << serializable_object;
See Question&Answers more detail:os