views:

47

answers:

2

Hi all,

Im trying to build a persistence module and Im thinking in serialize/deserialize the class that I need to make persistence to a file. Is possible with Boost serialization to write multiple objects into the same file? how can I read or loop through entrys in the file? Google protocol buffers could be better for me if a good performance is a condition?

regards!

+3  A: 

A Serialization library wouldn't be very useful if it couldn't serialize multiple objects. You can find all the answers if you read their very extensive documentation.

Nikola Smiljanić
Yes, I read it, but if you see the documentation, all the examples are making only one writing to the same file, and later they read this entry. But there is no example about looping through objects in the same file, or getting object serialized in file at position X. Could it be?
opernas
There is usually no need to loop yourself since the library can serialize both arrays and standard containers. And I don't think you can read the file from random location, serialization libraries work sequentially, you write all your objects in order and then you read them back in the same order.
Nikola Smiljanić
A: 
opernas