Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2007-12-01 12:46:29


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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net