|
Boost Users : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2005-09-30 11:42:27
Vladimir Prus wrote:
> Robert Ramey wrote:
> 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?
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.
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
c) add an intrusive serialize function
I believe that c would be the most straight forward - but probably the most
objectionable to the powers that be. So if you just need it for your own
purposes use c) and upload it to the vault. If you're a gluton for
punishment do b), upload it to the vault, and try to make a case for getting
the change accepted. a) would be just a hack - (though that's what I did
with the first implementation of shared_ptr - and I caught hell for it!) So
if you do this, you might want to keep it to yourself.
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