|
Boost Users : |
From: Nat Goodspeed (nat.goodspeed_at_[hidden])
Date: 2007-08-25 11:32:27
At 06:51 PM 8/18/2007, Dominick Layfield wrote:
>if you could provide me an example of when pointer serialization shines,
>then I would say "Aha! Now I understand why Robert went to so much trouble to
>make this work.", and I could be at peace with the world again! :-)
(Apologies if someone else has already said this more succinctly;
I'm still catching up with list traffic from a recent vacation.)
Suppose your application has classes A and B. Class A contains a
B* pointer. It doesn't directly contain a B instance; it points to a
distinct B instance.
To me, the most compelling argument for object tracking is when
you have two instances of A, a1 and a2, each of which points to the
SAME B instance b1.
a1 ---> b1 <--- a2
You serialize that data structure. When a subsequent run of the app
reloads it, let's say that you now have A instance a3 pointing to B
instance b3, and A instance a4 pointing to a distinct B instance b4.
a3 ---> b3 a4 ---> b4
Is that acceptable? Probably not, else why would the original session
have linked the data that way?
Object tracking is the way the serialization library recognizes
the shared B instance and reconstitutes two new A instances which,
again, contain pointers to the SAME B instance.
a3 ---> b3 <--- a4
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