Boost logo

Boost Users :

From: Sohail Somani (sohail_at_[hidden])
Date: 2008-03-11 16:21:42


Be warned that this is not thread-safe in the currently released versions
of Boost. I meant to inspect the latest version for thread-safety but
haven't got around to it (sorry Robert!)

On Tue, 11 Mar 2008 20:17:13 +0000, Jerry wrote:

> Jeff, thanks.
>
>> Look for the BOOST_...EXPORT macros, but they're still not automatic.
>
> Yep, that does it. Certainly automatic enough.
>
> For anyone searching the archives I think this is the archetype:
>
> //---------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-----------

-- 
Sohail Somani
http://uint32t.blogspot.com

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