Boost logo

Boost Users :

From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2004-12-03 14:43:04


"Jeffrey Holle" <jeff.holle_at_[hidden]> wrote in message
news:coqcn7$uhv$1_at_sea.gmane.org...
> At this point, the last compilation problem in applying the
> boost.serialization library to my application has to do with pointers.
>
> Specifically, its pointers to std::string and char member attributes.
>
...
>
> What is the solution to this?

>From a reply by Robert on the development thread:

"Hmmm - let me consider this. My view is based on the test test_list_ptr
which serializes a list of pointers. In this case each list element is
tracked because its a pointer. when a pointer is de-serialized a second
time, tracking assures that the pointer is reloaded.

In your case - std::string is tracked on output. When it its serialized a
second time, only the object ID is written out. So when it is read back in
the second time, the serialization system recognizes that its a copy and
just reloads it.

This only gotcha is that most primitive types are not tracked by default.
and std::string has been assigned a serialization trait of "primitive" that
means don't track. So I believe that this would work for non-primitive
types. If you need this to work for a primitive type (e.g. int, or...) use
a
serialization wrapper."

So it sounds like you'll need to turn on Object Tracking for these types at
a minimum, or creates appropriate wrappers.

Jeff Flinn


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