Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2006-10-17 12:16:24


Markus Werle wrote:
> Hi!
>
> I cannot figure out how to make some class behave like a primitive
> and let boost::serialization rely on ostream/istream operators
> for xml input. This makes sense to me for e.g. String representations
> other than std::string.
> It seems it does not suffice to define the iostream operators.

"primitive" types are those supported explicitly by the
class basic_?_?primitive with a function save/load
in this class.

There would be a number of ways of doing what you want depending
on the different usage scenarios.

The easiest would be just to define non-untrusive serialize templates for
these classes. If you want limited functionality (e.g. no tracking,
versioning)
then assign a lower implementation level - but one higher than primitive.
Implemenation can be anything you want. You might just want to lift
the implementation for std::string from basic??primitive. or not.

primitive is used for bypassing the whole serialization system itself so
it presumes direct support in the archive class. If you really want to
use primitive, be prepared to make your own archive and or
derive from an existing archive - and now your new type will only
work on your own archive .

Robert Ramey


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