Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2002-09-11 08:01:35


Peter Dimov wrote:
> From: "Vladimir Prus" <ghost_at_[hidden]>
>
>>I have tried hard to explain that while typeid would make archives
>>unportable between different machines (not really an issue if there's
>>denamgler for type_info::name() and I think work is underway on it),
>
>
> An issue. You never know whether, or how, type_info::name() is mangled, or
> whether there is type_info::name() at all (speaking of portable code.)

You still know that for any given platform.

> This (and the fact that given a type_info::name() you can't create an object
> of this type) drives most people writing serializers nuts. :-)
>
> The only portable C++-only solution (AFAIK) is to require registration of
> all polymorphic types, including an identifier that uniquely describes the
> type.

You see, proposed serialization library requires much more than that. It
requires the you
1. Register all polymorphic classes with any instance of
basic_{i,o}archive that you create
2. Register them in the same order everywhere.

It's possible to register polymorphic classes globally and in arbitrary
order, with static objects. I feel that requiremens above are very hard
to satisfy.

> Not only that, but you also need to register derived to base conversions,
> too, as I recently realized, since Derived * -> void * -> Base * is not
> required to work.

Why do you need such a conversion?

>>>There was quite a bit of discussion on the interface - particularly
>>
> regarding
>
>>>the describe functionality. I had nothing against it in priniciple, its
>>
> just
>
>>>that in practice it didn't really add anything.
>>
>>Except
>>1. It's much more terse
>
>
> And much less const-correct.

You mean that if 'describe' is not declared const, you can't serialize
const object without const_cast somewhere? Seems so. Did you say this
before?

I'm not yet sure what to do about it.

- Volodya


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