Boost logo

Boost :

From: Martin Wille (mw8329_at_[hidden])
Date: 2005-07-01 11:31:35


Michael Behrns-Miller wrote:

> 3) I realize I can split serialize() into separate load/save functions.
> However, I appreciate the recommendation to use one serialize() function,
> where the load/save order is easier to maintain. However again, I
> absolutely need (I think :>) to know, within that function, if I am
> loading or saving. It's the only way I can efficiently handle versioning
> or handle dynamic allocations, and still use one serialize() function, as
> far as I can tell. Bottom line: I now have
> isSaving(archive)/isLoading(archive) functions, can these be added to the
> library? Or am I approaching this wrong?

I think this approach is viable. However, I also think a different
approach could be better: using a Serialization Wrapper. With a wrapper
you're still be able to use the "ar &" notation while the wrapper itself
can split into load/save functions.

I recently discovered that (I'm a new user of Boost.Serialization
myself) while trying to write code that reuses operator << and operator
>> for saving/loading. (I sent Robert the code. He didn't have a chance
to answer, yet. The code works for me, but I think it's not yet
complete. If Robert thinks it is useful then we'll publish it here.)
During the writing, I missed some additional documentation about how to
write these wrappers and had to resort to reading the source. Since my
understanding of that topic isn't complete, I currently can't contribute
the documentation I missed.

Robert (and others), do you think some framework to enable users to
write their own wrappers would be useful? (A simple and slow one could
use user-provided functors for converting to/from a string.) Could you
comment on whether it is desirable to enable users to write their own
wrappers?

Regards,
m
Send instant messages to your online friends http://au.messenger.yahoo.com


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