1 Dec 2007 18:46
Re: serialization of vector of pointers
Robert Ramey <ramey <at> rrsd.com>
2007-12-01 17:46:29 GMT
2007-12-01 17:46:29 GMT
This is already built into the library. See test_list_ptr for an example how its done with std::list. std::vector should be the same. Robert Ramey Stathis wrote: > Hi, > > What is the right way to serialize/deserialize a container of > pointers, e.g. std::vector< int* > ? I want to store the values, not > the addresses in this case. Should I just flatten my data and store > it in a different fashion, then read the flat data and build my > objects with a builder? > > I ended up storing the size of the container in a separate variable > before the data, when serializing. Then when deserializing, I use > this size value to scale the container, create new ints, read their > individual values via the deserialized data values and finally store > them back to the new object. Can you give an example of how to do > this better? > > cheers, > --stathis
RSS Feed