Boost logo

Boost Users :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-09-30 02:28:03


Robert Ramey wrote:

> Vladimir Prus wrote:
>> So, my original question stands -- it is even possible to make
>> boost::any serializable?
>
> I've spent a few minutes looking at boost::any and don't see any obvious
> way
> to do it in a general way. If it is possible, it would only be so by
> depending on or expanding upon implementation of serialization.
>
> So, what can I suggest? Here are some very preliminary thoughts.
....
> template<class Archive>
> void my_class::load(Archive & ar, const unsigned int version){
> // define which types we think we will be = m_any;
> boost::variant<int, char, bool> v;
> ar >> v;
> m_any = v;
> }

I don't think this is good in general. If it's good, then we don't need
boost::any at all, we can just boost::variant.

What about idea I've expressed in another email:

  Guess we still need a way to register every new
  instantiation with the serialization library. Maybe, something like this
  will work:

   template<class T>
   class any_value_holder
   {
        static boost::proably_not_yet_written::serialization_register<
           any_value_holder<T> > register_it;
   };

Is it possible to make this work?

- 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