Boost logo

Boost :

From: Neal Becker (ndbecker2_at_[hidden])
Date: 2006-09-13 08:00:55


Simplified example (same problem):

#include <stdexcept>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/export.hpp>

struct overflow_policy_base2 {
  overflow_policy_base2 (double _min, double _max) :
    min (_min), max (_max) {}
  virtual double apply (double) = 0;
  double min, max;

  friend class boost::serialization::access;

  template<class Archive>
  inline void serialize (Archive &ar, const unsigned int) {
    ar & min;
    ar & max;
  }
};

BOOST_IS_ABSTRACT (overflow_policy_base2)

struct limit_policy2 : public overflow_policy_base2 {
  limit_policy2 (double _min, double _max) :
    overflow_policy_base2 (_min, _max) {}

  virtual double apply (double x) {
    if (x > this->max)
      return this->max;
    else if (x < this->min)
      return this->min;
    else
      return x;
  }

  template<class Archive>
  inline void serialize (Archive &ar, const unsigned int) {
    ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP (overflow_policy_base2);
  }

};

BOOST_CLASS_EXPORT (limit_policy2)

g++ -I /usr/local/src/boost.cvs -xc++ -fsyntax-only test.hpp
/usr/local/src/boost.cvs/boost/serialization/type_info_implementation.hpp: In instantiation of ‘boost::serialization::type_info_implementation<limit_policy2>’:
/usr/local/src/boost.cvs/boost/serialization/export.hpp:76: instantiated from ‘boost::archive::detail::guid_initializer<limit_policy2>’
test.hpp:43: instantiated from here
/usr/local/src/boost.cvs/boost/serialization/type_info_implementation.hpp:50: error: invalid use of undefined type ‘struct boost::serialization::extended_type_info_impl<limit_policy2>’
/usr/local/src/boost.cvs/boost/serialization/traits.hpp:42: error: declaration of ‘struct boost::serialization::extended_type_info_impl<limit_policy2>’


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