|
Boost : |
Subject: Re: [boost] [multi_index][serialization] save_construct_data not called for multi_index collection
From: joaquin_at_[hidden]
Date: 2009-12-21 11:14:47
Felipe Magno de Almeida escribió:
> Hi,
>
> Boost.Serialization has support for non-default classes using
> save_construct_data and load_construct_data overloads.
> These are called before serialization to save and load information
> that's important for the construction of the object.
> Unfortunately, multi_index doesn't call these functions when
> serializing, so serialization of non-default-constructible classes is
> impossible with multi_index.
>
Hi, seems you spotted a bug here. load_construct_data_adl is actually used
(see boost/multi_index/detail/archive_constructed.hpp ), but this is not
the case
for save_construct_data_adl, which is also necessary.
I'll fix this. I'd appreciate if you can file a ticket in the Trac
system. Meanwhile
you can try your hand patching boost/multi_index_container.hpp: lines
646-647
(in 1.41, some offset might occur in 1.38) look like
for(iterator it=super::begin(),it_end=super::end();it!=it_end;++it){
ar<<serialization::make_nvp("item",*it);
save_construct_data_adl should be called before "ar<<..." with *it. Please
report back about your success or lack of it.
Thank you for using Boost.MultiIndex.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk