Boost logo

Boost Users :

From: Luca Cappa (luca.cappa_at_[hidden])
Date: 2007-04-20 03:58:40


Hello,

notice that I am using Boost version 1.33.1.

On Fri, 20 Apr 2007 07:44:37 +0200, Robert Ramey <ramey_at_[hidden]> wrote:
> Luca Cappa wrote:
>> 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

I confirm that the NULLs parameters are required for version 1.33.1: just
looking at the source codes of those two examples, and in the first I do
not see the usage of void_cast_register at all, whilst in the second i
read:

     // note that a fundamental feature is that derived/base pairs are
created
     // at compiler time so that all are registered before the main program
starts
     // so leave the registration here at the end to verify this. Note
bogus arguments
     // to workaround msvc 6 bug
     boost::serialization::void_cast_register<Derived, Base1>(
         static_cast<Derived *>(NULL),
         static_cast<Base1 *>(NULL)
     );

>> 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.

I see this code also in the last version of the Boost cvs repository, but
it is also true that in the
last version the NULL parameters are the default arguments, ie:

template<class Derived, class Base>
....
   void_cast_register(
     const Derived * dnull = NULL,
     const Base * bnull = NULL

but the documentation is for 1.33.1, not for the very latest version :)

>> 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 _!!!)

Ok, thanks a lot for your time,

Greetings,
Luca


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