I happy to defer to you guys on this as I only gave it a very cursory look. I would like to see boost::any serializable. My short look made me think it couldn't be done without modfication of boost::any but I would be pleased to be proven wrong. Those who need this and want to make it happen have my full encouragement. Personally I don't see why a small modification to boost::any should be a problem it that would help make it serializable - but as I said, I'm happy to let those who actually need it deal with it. Good Luck, Robert Ramey Vladimir Prus wrote:
Robert Ramey wrote:
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?
I think you would also need to explicitly instantiate it for each type. Which puts us back to square one of having to specify the types ahead of time.
With some cooperation from boost::any, this is not necessary:
template<class T> class any_holder { public: any_holder() { ®istrator_; }
private: static registrator<T> registrator_;
};
will run constructor of 'registrator_' while generating no code in any_holder's constructor. Complete example attached.
Its possible that progress could be made here, but I think it would be pretty tricky. Here are some off hand ideas.
It seems to me that boost::any is a basically a wrapper around a pointer to a type ValueType. If ValueType is exported it would possible to make things work. However, boost::any public interface doesn't expose enough of its public interface to make it serializable. So if one wanted to do this he would have to do one of the following:
a) make some private variables public b) add some functions to expose required implementation features
Namely? boost::any already has
const std::type_info & type() const;
method and if it can be used to implement non-intrusive serialization, this will be great.
- Volodya
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users