|
Boost Users : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2007-04-20 01:44:37
Luca Cappa wrote:
> 2) Since I do not like to serialize the base object, I do not want to
> call boost::serialization::base_object in the derived serializing
> method, but instead I wish to just explicitly register base/derived
> relationship with:
>
> boost::serialization::void_cast_register<derived, base>();
> as the section Runtime Casting tells the reader. But it does not work
> (compilation fails), I still need to add two NULLs parameters to that
> function, such as:
>
This would news to me. As far as I know it works. Send
an example. For a working example see
boost\serialization\shared_ptr_132.hpp and test_void_castcpp
> boost::serialization::void_cast_register<Serializable,
> SerializableBase>(NULL, NULL);
>
> so the code of derived::base::serialize method of the example should
> be corrected. By the way in file void_cast_fwd.hpp for the method
> void_caster::void_cast_register the default arguments to NULL appear
> to be commented out, I wonder why.
Hmmm - I'm not seeing this.
>
> 3) What is preferred statement between
>
> oa.register_type (static_cast<Serializable*> (NULL));
>
> and
>
> oa.register_type<Serializable> (); // I don't think this is legal
>
Some older compilers only work with the former. Modern compilers can
use ar.template register_type<T>(); (note the missing _!!!)
> ?
> I tested that either works fine with VC8, and I guess they work fine
> with gcc4 too, but i wonder why I see in
> the examples of Boost the former used in place of the latter form
> which is commented out.
>
> Best regards,
> Luca Cappa
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