Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2005-05-13 11:28:42


martin f krafft wrote:
> > Alternatively, or additionally, within the cyclic object
> > themselves, it would be nice if it was possible to serialize the
> > pointer without serializing its contents, i.e. creating only an
> > index in the archive, making it up to the user to make sure that
> > the object is later serialized with that index to adress it.
>
> That's more or less how the serialization of pointers works now
> - and that's why it DOES work.

If I end up not serialising the pointee object, the framework does
serialise it automatically, right? That is to say:

  {
    A a;
    a.x = 5;
    ar << &a;
  }

  //...

  A *b
  ar >> b;
  assert(b->x == 5)

should work just fine, right?

That should work.

for symetry I would have written

{
    const A *a = new A(5);
    ...
    ar << a;
    ...
    A *new_a;
    ...
    ar >> new_a
    ..
    assert(*a == *new_a);
}

Note the slightly trick usage of const in this example which has been the
subject of recent posts and is explained in the manual section describing
tracking.

Robert Ramey


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