Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2002-12-18 11:03:49

From: Matthias Troyer <troyer_at_[hidden]>

>> template<class Archive>
>> void save(Archive &ar, T& t)
>> {
>> ar << member1;
>> ...
>> }

>Here we have a problem as far as I can see: if the class is
>polymorphic, how can I serialize the derived class by calling the
>save() function of the base class?

the current serialization code doesn't rely on save being virtual
to function. It downcasts the base class pointer to the most
derived class and calls the save function on the recast pointer.
This casting is implemented by void_cast.

Robert Ramey

Boost list run by bdawes at, gregod at, cpdaniel at, john at