Boost logo

Boost :

From: Neal D. Becker (ndbecker2_at_[hidden])
Date: 2004-04-29 14:22:51


Serialization18 reference suggests this should work (this is almost verbatim
from the section on seperate load/store free function):

#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/serialization/vector.hpp>

template<class Archive>
void load (Archive& ar, std::complex<double>& z, const unsigned int version)
{
  double r, i;
  ar >> r;
  ar >> i;
  z = Complex (r, i);
}

namespace boost { namespace serialization {
  template<class Archive>
  inline void serialize(Archive & ar, std::complex<double>& z, const
unsigned int file_version) {
    split_free(ar, z, file_version);
  }
}}
 
Claims "load" is not declared.
But adding boost::serialization namespace will fix it:

namespace boost { namespace serialization {
template<class Archive>
void load (Archive& ar, std::complex<double>& z, const unsigned int version)
{
  double r, i;
  ar >> r;
  ar >> i;
  z = Complex (r, i);
}
}}

This was tested with gcc-3.3.2. Is this a doc bug?


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