
11 Mar
2006
11 Mar
'06
9:45 p.m.
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 ).