Boost logo

Boost Users :

Subject: [Boost-users] [serialization] issues when writing non-intrusive code
From: Sean Farrow (sean.farrow_at_[hidden])
Date: 2012-02-18 12:55:04


Hi:
I am writing some non-intrusive serialization code for other c++ classes.
I am trying to serialize the wxString class from the wxWidgets library.
I have the following code:
namespace boost {
namespace serialization {

template<class Archive>
void serialize(Archive & ar, wxString & str, const unsigned int version)
{
                ar & str.ToStdWstring();
}
}
}
I noticed the following two typedefs in the wxWidgets code:
    typedef std::wstring wxStdWideString;
    typedef std::basic_string<wchar_t> wxStdWideString;
only one of these is executed.
I then wrote a second unintrusive serialization class:
namespace boost {
                namespace serialization {
                                template<class Archive>
void serialize(Archive & ar, wxString & str, const unsigned int version)
{
                ar & str;
}
                }
}
I am getting the following error, using visual c++ 2010:
     1>c:\program files (x86)\boost\boost\archive\basic_xml_oarchive.hpp(92): error C2664: 'boost::mpl::assertion_failed' : cannot convert parameter 1 from 'boost::mpl::failed ************boost::serialization::is_wrapper<T>::* ***********' to 'boost::mpl::assert<false>::type'
                 with
                 [
                     T=const wxStdWideString
                 ]
Given that I have written code to serialize the wxStdWideString typedef, does anyone know what is happening? Are typedefs ignored with boost serialization. Currently using 1.47.
Cheers
Sean.



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