Boost logo

Boost Users :

From: Kim Barrett (kab_at_[hidden])
Date: 2006-07-09 22:29:41


At 9:13 AM +0800 7/10/06, Joel de Guzman wrote:
>Say with version 1, I want to serialize X Y and Z. These
>are hierarchical and expensive data structures. Now, with
>version 2, I do not need to create Y objects anymore. Yet,
>I still have to open version 1 files for backward compatibility.
>So, when loading version 1 files, I want to skip reading Y
>objects. How do I do that without having to create a temporary
>Y object that will be discarded later?
>
>(I'm particularly interested with XML archives. If I had control
>over the xml parser, that would simply mean ignoring everything
>from the current tag until the next matching tag is found).

I think such a simple approach will not work in general. Consider
the case where

1. your Y contains a pointer to P
2. pointer tracking is enabled for P's type
3. the occurrence of P in Y is the first occurrence within the archive
4. there are later occurrences of P in the archive after Y

If you simply discard everything involved in constructing Y, you will
discard the information needed to construct and record P, and those
later occurrences will be left dangling.


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