Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2007-02-16 11:37:11


Aljaz wrote:
>>> Do I have to register_type this way? Can I use BOOST_EXPORT ..
>>> instead?
>>
>> Yes
>
> I tried doing BOOST_CLASS_EXPORT(B), but program crashed when I
> wanted to deserialize data..

I don't know what to say here. Its been tested, demo'ed and documented.
.
> Why I want to ID derived class through base class? Because derived
> class will contain a lot of data, that wont be in base class.

>> This topic is addressed in Scott Meyers "Effective
>> C++"

> I already made function get_type() that returns type of derived
> class.. But I still have no idea if I have smart pointer to base
> class, how do I get smart pointer do derived class from it?

I would expect one could do a dynamic cast of the shared ptr - but this
is really a question for someone else.

> Is there any example using extended_type_info family to do something
> similar?

I looked at the documentation for extended_type_info which requires the
implementation
of get_derived_type_info for each kind of extended_type_info object created.
However its
not document for general usage. I suppose that this is because that I
didn't think it would
be used for anything other than an implementation detail. Subsequently
however, I
used it as part of boost/serialization/detail/shared_ptr_helper. You can
look into that file
to see how this was done.

Robert Ramey


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net