Boost logo

Boost :

From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2002-01-24 16:02:28


Matthias Troyer wrote:
> I have looked at Jens Maurer's efforts in the boost files section,
> which unfortunately seems to be idling there and not developed further.

This is unfortunately true. I meant to do something about this
for a long time, but never got around to actually doing
something. Sorry.

> i) I often have to (de)serialize large arrays of numbers, for which an
> optimized function should exist that can (de)serialize a C-array in
> one function call. This also allows support for data formats such as
> HDF

You should be able to partially specialize the (de)serialization
functions on something like
 double (&)[n]
where n is a template parameter.

> ii) (De)serialization of pointers

Cyclic stuff as well?

> iii) using runtime polymorphism with the persistence library. At the
> moment
> only compile time polymorphism is implemented, and the Reader/Writer
> needs to be chosen at compile time.

Writing is easy.
What about this for reading:
Overload the global fucntion that the readers/writers delegate to on
a "Base *&". When the system needs to read a "Base *", it calls this
function. Then, you know your base type, and you can use any
fancy virtual constructor approach that you prefer to create your
"Derived*" and assign it to the "Base *" variable.

Just an idea, untested.

Jens Maurer


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