Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2005-09-27 10:18:07


Vladimir Prus wrote:
> Li Lirong wrote:
>
>> Hi,
>> 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?
>
> - Volodya

This would tie the GUID "any_value_holder" to multiple types
any_value_holder<T> so it wouldn't be unique any more. 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.

Good Luck

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