|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-11-24 10:50:52
Robert Ramey wrote:
>> Perhaps Robert can state for himself whether he considers
>>
>> http://lists.boost.org/Archives/boost/2005/11/97058.php
>>
>> unacceptable, and why.
>
> This link doesn't work for me.
"""
Looking at collections_save_imp.hpp:
template<class Archive, class Container>
inline void save_collection(Archive & ar, const Container &s)
{
// record number of elements
unsigned int count = s.size();
ar << make_nvp("count", const_cast<const unsigned int &>(count));
BOOST_DEDUCED_TYPENAME Container::const_iterator it = s.begin();
while(count-- > 0){
//if(0 == (ar.get_flags() & boost::archive::no_object_creation))
// note borland emits a no-op without the explicit namespace
boost::serialization::save_construct_data_adl(ar, &(*it),
0U);
ar << boost::serialization::make_nvp("item", *it++);
}
}
all that needs to be done is:
template<class Archive, class It>
inline void save_sequence(Archive & ar, It it, unsigned count)
{
while(count-- > 0){
//if(0 == (ar.get_flags() & boost::archive::no_object_creation))
// note borland emits a no-op without the explicit namespace
boost::serialization::save_construct_data_adl(ar, &(*it),
0U);
ar << boost::serialization::make_nvp("item", *it++);
}
}
template<class Archive, class Container>
inline void save_collection(Archive & ar, const Container &s)
{
// record number of elements
unsigned int count = s.size();
ar << make_nvp("count", const_cast<const unsigned int &>(count));
save_sequence( ar, s.begin(), count );
}
unless I'm missing something fundamental.
"""
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk