$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Matthias Troyer (troyer_at_[hidden])
Date: 2002-12-18 11:34:19
On Wednesday, December 18, 2002, at 05:03 PM, Robert Ramey wrote:
> 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.
How can you determine the most derived class? Do you try all classes
that were registered to find the most derived one?
Matthias