|
Boost Users : |
Subject: Re: [Boost-users] [serialization] serializing a pointer without causingobject tracking
From: Stefan Strasser (strasser_at_[hidden])
Date: 2013-04-01 13:42:09
Am 30.03.2013 19:03, schrieb Robert Ramey:
>> is there a solution to this? is there a serialization wrapper that
>> says "don't track this type just because of this pointer"?
>
> so you want "don't track this particular save - but leave others as normal"
>
> Try something like
>
> class A ....
>
> class UntrackedA : public A {
> ...
> };
>
> BOOST_SERIALIZATION_TRACK(UntrackedA, track_never);
interesting idea. does this eventually track the object if the base
class of UntrackedA is track_selectively and saved through a pointer
anywhere else?
for example, an object graph that stores a pointer to its own root
(through intermediaries in practice):
class A{ //tracking level: selectively
void serialize(...){ ar & a; }
A *a; //==this
};
class UntrackedA : A{ //tracking level: never
void serialize(...){ ar & base_object<A>(*this); }
}
void save(UntrackedA *a){ ar << a; }
is "a" serialized twice, or tracked because of track_selectively and the
pointer serialization in A::serialize?
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