
Hmm ok I split up the save() and load() functions so I can just
serialize the individual members of these 3rd party classes. That
works ok. The save() method is defined like:
voidd save(Archive &ar, const unsigned int version) const
{
ar & m_3rdPartyClass.m_SomeInteger;
...
}
One of the data types though is MFC's CString - which is just like
std:string, just a wrapper around a character array. The only way to
get the contents of a CString as a char array is a function called
GetBuffer() which returns a non-const char pointer to the internal
array. My compiler does not seem to like this, as I guess the save()
function is defined as const? Is this right, and if so, is there any
way I can get around this one?
ar & m_3rdPartyClass.m_SomeCString.GetBuffer(); // returns non
const char* !!
Thanks,
Mark
On 2/9/07, David Klein
Mark Wyszomierski wrote:
Hi, I'm using the boost serialization methods, they're great. I'm using some 3rd party classes that I don't have access to, so I can't add a serialize() member function to them. It's something like:
class CMyClass { int m_nWhatever; CSomeClass m_sc; // I am just using this from someone else's library....
void serialize(Archive &ar, const unsigned int version) { ar & version; ar & m_nWhatever; ar & m_sc; // fails!!! } }
how can I get around this?
Thanks, Mark _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi Mark,
you don't necessarily need a member function. see f.ex:
http://boost.org/libs/serialization/doc/tutorial.html#nonintrusiveversion
-- HTH dave
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users