Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2004-05-05 09:55:59


Lirong wrote:

> I remember that pointers to built-in types can not be serialized
> directly in earlier versions of the library. The user would have to
> write a wrapper around the built-in type. How is the situation now?

The default serialization traits are such that pointers to primitive types
are set to not-serializable.

Suppose you set the implementation_level<long> to object serializable and
serialize a pointer to a long. This well mean that all serialized longs
have to be tracked. Do you want something like this to happen? Its possible
to serialize a pointer to primitive - I just can't imagine a case where one
would want to do because of the side effects it would cause. That's why I
recommend wrapping the primitive in its own type so that you don't create a
lot of unexpected/undesired side-effects. Look at strong typedef for a
simple cheap automatic wrapper.

Robert Ramey


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk