Boost logo

Boost Users :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-09-28 01:29:37


Robert Ramey wrote:

>>> Do we have serialization support for boost::any? If not, how is it
>>> possible to serialize boost::any?
>>
>> Good question. Robert, is it possible to place BOOST_CLASS_EXPORT
>> inside class definition, so that I can write something like that:
>>
>> class any_base {};
>> template<class T>
>> class any_value_holder : public any_base
>> {
>> .......
>> BOOST_CLASS_EXPORT(any_value_holder);
>> };
>>
>> and have BOOST_CLASS_EXPORT run for each instantiation of
>> any_value_holder?

>
> This would tie the GUID "any_value_holder" to multiple types
> any_value_holder<T> so it wouldn't be unique any more.

So, basically we can't make "any" serializable?

> This is another
> manifestation of the general problem of retreiving an external string from
> a
> typename. type_info does this but in a non-portable way. Of course you
> know this as you rasied this issue in the first place.

> Much fame and fortune will accrue to he who creates the function
>
> template<typename T>
> char * guid()
>
> which returns a unique char string in a platform independent way.

But failing that, what about adding the following macros:

   I_WANT_TO_USE_TYPEID_WHEN_SERIALIZING_DERIVED_CLASSES_OF(any_base)

or

   USE_THE_FOLLOWING_FUNCTOR_TO_GET_GUI_FOR_CLASSES_DERIVED_FROM(any_base,
             serialization::typeid_guid_maker)

? At least that would make boost::any serializable.

- Volodya


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