Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Serialization not building
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-10-14 08:13:31


On Wed, Oct 14, 2009 at 1:04 AM, OvermindDL1 <overminddl1_at_[hidden]> wrote:
> /* snip */

I also appear to have another error while trying to serialize a shared_ptr:

1>R:\SDKs\boost\built_head\include\boost-1_40\boost/archive/shared_ptr_helper.hpp(114)
: error C2440: 'return' : cannot convert from 'const
boost::serialization::extended_type_info_typeid<T>' to 'const
boost::serialization::extended_type_info *'
1> with
1> [
1> T=User
1> ]
1> No user-defined-conversion operator available that can
perform this conversion, or the operator cannot be called
1> R:\SDKs\boost\built_head\include\boost-1_40\boost/archive/shared_ptr_helper.hpp(110)
: while compiling class template member function 'const
boost::serialization::extended_type_info
*boost::archive::detail::shared_ptr_helper::non_polymorphic<T>::get_object_identifier(T
&)'
1> with
1> [
1> T=User
1> ]
1> R:\SDKs\boost\built_head\include\boost-1_40\boost/archive/shared_ptr_helper.hpp(147)
: see reference to class template instantiation
'boost::archive::detail::shared_ptr_helper::non_polymorphic<T>' being
compiled
1> with
1> [
1> T=User
1> ]
1> R:\SDKs\boost\built_head\include\boost-1_40\boost/serialization/shared_ptr.hpp(142)
: see reference to function template instantiation 'void
boost::archive::detail::shared_ptr_helper::reset<User>(boost::shared_ptr<T>
&,T *)' being compiled
1> with
1> [
1> T=User
1> ]
1> R:\SDKs\boost\built_head\include\boost-1_40\boost/serialization/split_free.hpp(58)
: see reference to function template instantiation 'void
boost::serialization::load<Archive,User>(Archive
&,boost::shared_ptr<T> &,const unsigned int)' being compiled
1> with
1> [
1> Archive=boost::archive::text_iarchive,
1> T=User
1> ]
1> R:\SDKs\boost\built_head\include\boost-1_40\boost/serialization/split_free.hpp(54)
: while compiling class template member function 'void
boost::serialization::free_loader<Archive,T>::invoke(Archive &,T
&,const unsigned int)'
1> with
1> [
1> Archive=boost::archive::text_iarchive,
1> T=boost::shared_ptr<User>
1> ]
1> R:\SDKs\boost\built_head\include\boost-1_40\boost/serialization/split_free.hpp(74)
: see reference to class template instantiation
'boost::serialization::free_loader<Archive,T>' being compiled
1> with
1> [
1> Archive=boost::archive::text_iarchive,
1> T=boost::shared_ptr<User>
1> ]
1> R:\SDKs\boost\built_head\include\boost-1_40\boost/serialization/shared_ptr.hpp(157)
: see reference to function template instantiation 'void
boost::serialization::split_free<Archive,boost::shared_ptr<T>>(Archive
&,boost::shared_ptr<T> &,const unsigned int)' being compiled
1> with
1> [
1> Archive=boost::archive::text_iarchive,
1> T=User
1> ]

/* snip a *lot* more errors, but this is the top chunk */

I have spent about the last 4 hours changing one thing and changing
another and nothing I do seems to ever work. And yes it happens with
different archive types and so forth. I think I narrowed down the
issue to line 42 in file
boost\serialization\type_info_implementation.hpp but I am not certain,
if it is not this line directly it is something that builds it up...
Yes I do include the shared_ptr helper as the examples show
(serialization\example\demo_shared_ptr.cpp), and tried various macros
for registering it and so forth...

I did find one thing that gets it to compile, if I make the class
virtual (which I really would prefer not to do, it is a very simple
and lightweight class that will never be subclassed), then it does
work (which further proves that it is the afore-mentioned line number
in that type_info_implementation file).

So any ideas why a non-virtual class/struct causes Boost.Serialization
to choke in a shared_ptr (but works fine as a normal pointer), but a
virtual one works? I looked through the documentation and did not
find such a remark.

Also, I noticed that the tr1 containers are not supported, such an
unordered_set. I created my own serializer for those, but it seems
odd that it is not included since it seems to contains everything else
from the stl, and the tr1 containers have been in Boost for quite some
time now...


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