Boost logo

Boost Users :

Subject: [Boost-users] How to prevent boost serialize from object tracking a pointer
From: Frank (franknfrank_at_[hidden])
Date: 2011-04-22 16:39:32

Hi all,

I have a shared_ptr to an object that changes (the underlying object is
non-const, that is, not the shared_ptr), and I'd like to serialize the
object each time it changes (size of the archive is not an issue). The
problem stems, I think, from object tracking: every time after the first
serialization, boost detects that the pointer is the same, and does not
write out the (full, updated) object.

I've tried putting in BOOST_CLASS_TRACKING(T,
boost::serialization::track_never) but it won't compile because there is a
BOOST_STATIC_ASSERT in shared_ptr.hpp that prevents setting class T's
tracking to track_never if it is then serialized via a shared_ptr, with the
comment that "correct shared_ptr serialization depends upon object tracking
being used."

Am I missing something obvious here, or is another a way to accomplish this?
Any help would be greatly appreciated...


View this message in context:
Sent from the Boost - Users mailing list archive at

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at