
In attempting to test serialization input for the proposed Boost Units library, I am getting this error : /Users/matthiasschabel/Code/boost-CVS-HEAD-07-02-21-1603/boost/ archive/detail/iserializer.hpp:589: error: no matching function for call to 'load_wrapper(boost::archive::binary_iarchive&, const double&, boost::serialization::is_wrapper<double>)' corresponding to this code : std::ifstream ifs ("boost_units_serialize_test.txt",std::ios::binary); boost::archive::binary_iarchive bia(ifs); for (int i=0;i<100;++i) { quantity<CGS::area> ac; bia >> ac; } ifs.close(); where I have defined /// Boost Serialization library support for quantities. template<class Archive,class Unit,class Y> inline void serialize(Archive& ar,boost::units::quantity<Unit,Y>& q,const unsigned int version) { ar & q.value(); } Am I missing something obvious here? I get basically the same error if I try using text_iarchive instead... Matthias

The error message suggests that we're trying to change the value of a const reference. does q.value() return a ref to a const? perhaps instead of serializing q.value() you want to serialize the underlying value directly and making serialization::access a friend of boost::units::quantity<Unit,Y> Robert Ramey Matthias Schabel wrote:
In attempting to test serialization input for the proposed Boost Units library, I am getting this error :
/Users/matthiasschabel/Code/boost-CVS-HEAD-07-02-21-1603/boost/ archive/detail/iserializer.hpp:589: error: no matching function for call to 'load_wrapper(boost::archive::binary_iarchive&, const double&, boost::serialization::is_wrapper<double>)'
corresponding to this code :
std::ifstream ifs ("boost_units_serialize_test.txt",std::ios::binary);
boost::archive::binary_iarchive bia(ifs);
for (int i=0;i<100;++i) { quantity<CGS::area> ac;
bia >> ac; }
ifs.close();
where I have defined
/// Boost Serialization library support for quantities. template<class Archive,class Unit,class Y> inline void serialize(Archive& ar,boost::units::quantity<Unit,Y>& q,const unsigned int version) { ar & q.value(); }
Am I missing something obvious here? I get basically the same error if I try using text_iarchive instead...
Matthias _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Robert, Thanks - you hit the nail on the head. I had commented out the mutating value() accessor as a test and forgot to uncomment it... Sorry for the false alarm. Matthias
The error message suggests that we're trying to change the value of a const reference.
does q.value() return a ref to a const?
perhaps instead of serializing q.value() you want to serialize the underlying value directly and making serialization::access a friend of boost::units::quantity<Unit,Y>
Robert Ramey
participants (2)
-
Matthias Schabel
-
Robert Ramey