Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-03-11 16:45:36


Carlo Wood wrote:

> 1) WHY does boost::serialization not support serialization
> of iterators?

It's very hard, if not impossible, in general.

> 3) My original question hasn't been answered: How can
> one serialize iterators with boost::serialization?

If you have access to the container to which the iterator i refers:

a) if the container is a map, you can serialize i->first, then on
deserialization look up the key in the map using .find();

b) if the container is a sequence, and it has the same contents on
deserialization as it does on serialization, you can serialize the index of
the element - distance( c.begin(), i ).


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