Boost logo

Boost Users :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2006-09-15 12:19:44


Joaquín Mª López Muñoz wrote:

> The following test program:
>
> #include <boost/archive/text_oarchive.hpp>
> #include <sstream>
>
> int main()
> {
> int x=0;
> int* const px=&x;
> std::ostringstream oss;
> boost::archive::text_oarchive oa(oss);
> oa<<px;
>
> return 0;
> }
....
> I've checked the same snippet against Boost 1.33.1, CVS HEAD and
> RC_1_34_0, using other primitive types like std::string, same problem
> always. Same problem also for the loading counterpart. When the
> pointed-to type is not primitive, though, everything works fine,
> regardless
> of whether the type has intrusive or non intrusive serialization
> support.
>
> I am sure I'm doing something really stupid here, but I've been banging
> my head against this several hours. Some clue greatly appreciated.

This never worked, I think. The problem is that if you're saving pointers,
you need to check if you've already saved that pointer, so that on loading,
you don't get two pointers to to ints, as opposed to two pointers to a
single int, as it should be.

This "tracking" requires runtime map, and I believe Robert decided that
maintaining such map for primitive type can be too expensive. I'm not sure
how valid that point it, not how many hidden stones there are in enabling
primitive types to be tracked.

- Volodya


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