Boost logo

Boost :

From: Jared McIntyre (jmcintyre_at_[hidden])
Date: 2004-12-02 13:44:16


I've been out of town, so I haven't had the chance to look back at
this issue until today. This is the code for the non-intrusive
serializer:

template<class Archive>
void serialize(Archive & ar, SWHandle & handle, const unsigned int version)
{
     std::string strHelper( handle.toCharString() );
     ar & make_nvp("swhandle_guid", strHelper);
     handle = strHelper.c_str();
}

I don't have access to the internal data of SWHandle, so I am trying
to work around that in the functions so that it work for both
serialization and deserialization (since I'm not aware of an easy way
to split them like you can the class version). The namespaces
shouldn't be an issue (in this case, everything is operating in the
global namespace). I'm not seeing any real difference between my
code and the

Jared

>Double check the example test_nonintrusive and compare it to your case.
>Check the following:
>
>a) const vs non const parameters
>b) unsigned vs int declarations for version
>c) namespace. Since vc 7.1 implements ADL its best for the specializations
>to be in the same
>namespace as the datatype being serialized.
>
>Robert Ramey
>
>"Jared McIntyre" <jmcintyre_at_[hidden]> wrote in message
>news:a06110401bdc439f0fdf5@[192.168.1.101]...
>> I have a class that I am serializing using the non-intrusive method.
>> It serializes just fine, but when I code the input stream, the
>> compiler complains that the class doesn't implement the serialize
>> function (which is, of course, true since I'm am doing the
>> non-intrusive method on this class). Any idea what could be going
>> wrong? The class I'm wrapping is being serialized as part of another
>> class (if that helps at all).
>>
>> Visual Studio 7.1
>> Boost 1.32.0 tar ball
>> Wide character XML output
>>
> > Jared McIntyre


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