Boost logo

Boost Users :

Subject: Re: [Boost-users] Serialization of boost::gregorian::date
From: Peter Bartlett (pete_at_[hidden])
Date: 2010-07-07 09:42:18


Quoting Nguyen Kim Son <nguyenkims_at_[hidden]>:

> Hello,
>
> Do you know how to serialize class boost::gregorian::date? More generally,
> is it possible to serialize a class in whose we can't change the code
> source ?
>
> Thanks in advance,
> Son.

It is already serializable - include
boost/date_time/gregorian/greg_serialize.hpp

In fact it is an example of non-intrusive serialization (uses only
public interface) so you could've done this yourself, so yes it is
possible.

However it _also_ serves as a warning.. the serialization is slow...
much slower than would be possible with intrusive serialization which
knows about the internal representation.

So to conclude, you picked a good example!

Pete


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