Boost logo

Boost :

Subject: Re: [boost] [serialization] [1.41] serialization of shared_ptr<> failsto compile
From: Robert Ramey (ramey_at_[hidden])
Date: 2009-11-23 11:16:25


I think your correct. There is a bug and your fix addresses it. I'm
still looking at this.

Robert Ramey

Marco Jez wrote:
> Hello, I'm still having troubles with Boost.Serialization in Boost
> 1.41. The following example code fails to compile with latest Boost
> release, while it works with 1.39:
>
>
> #include <boost/archive/binary_iarchive.hpp>
> #include <boost/serialization/shared_ptr.hpp>
> #include <boost/shared_ptr.hpp>
> #include <iostream>
>
> // dummy struct with no actual serialization code
> struct Test { template<typename A> void serialize(A &, unsigned) {} };
>
> int main()
> {
> boost::archive::binary_iarchive ia(std::cin);
>
> boost::shared_ptr<Test> x;
> ia & x;
>
> return 0;
> }
>
>
> The compiler (MSVC 9) gives me this error:
> error C2440: 'return' : cannot convert from 'const
> boost::serialization::extended_type_info_typeid<T>' to 'const
> boost::serialization::extended_type_info
> *'c:\boost\include\boost-1_41\boost\archive\shared_ptr_helper.hppIt
> seems that an address-of (&) operator is required in
> shared_ptr_helper.hpp at line 111, that is:
> ...
> return boost::serialization::singleton<
> ...
>
> should read:
>
> ...
> return &boost::serialization::singleton<
> ...
>
> This change makes my code compile, but I'm not sure whether it's an
> appropriate fix or not, as I don't know Serialization's internals.
>
> Cheers,
> Marco
>
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk