Boost logo

Boost Users :

From: Jerry (jerry_at_[hidden])
Date: 2008-03-21 06:48:19


Sohail,

> Might be a long shot, but are you sure you've done this throughout your
> code:
>
> http://www.boost.org/libs/serialization/doc/special.html#export

Yes, all done. The failing code is _after_ the check for unregistered
classes. No exception is thrown, but the assert() is triggered.

BTW here's the general form as I outlined a few weeks back: Can you see any
problems.

//---------header file-----------

// example derived serializable class
class derived : public base
{
    std::string m_name;
    friend class boost::serialization::access;
    template<class Archive>
    void serialize(Archive &ar, const unsigned int /*version*/)
   {
        // serialize base class
        ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(base);
        // handle any members in derived
        ar & BOOST_SERIALIZATION_NVP(m_name);
   }
   public:
   derived() {}
};

// ensure correct ID generation when saving via base*
// if this is omitted you'll get an unregistered exception unless
// you register each class directly with the archive
BOOST_CLASS_EXPORT_GUID(derived,"derived")

//--------------/header file---------------


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net